Windows Form Dictionary

O

oz

Hi All,
I want to make a dictionary with windows application. My data is html
format. therefore, i use webBrowser control on my windows form. If
the
user click any word in webBrowser control, word mean must browse to
user (like babylon).

I have a windows form. My form has webBrowser control. I fill a html
content with javascript (Dictionary.js) to webBrowser.

Javascript (dictionary.js) can obtain the word if user double click
on
the word.

I must to send this word another windows form. Thus, i will learn
this
word mean.

My question is; Can the javascript call the windows form server
code ?

if it can not, how can i do that?

Note: Visual Studio 2005

Thanks any suggestion.
Öznur
 
S

Stefan Hoffmann

hi Oz,
My question is; Can the javascript call the windows form server
code ?
if it can not, how can i do that?
Note: Visual Studio 2005
If i understand you correctly, then you must use the
webBrowser1_Navigating event of the WebBrowser control.

mfG
--> stefan <--
 
O

oz

hi Oz,


If i understand you correctly, then you must use the
webBrowser1_Navigating event of the WebBrowser control.

mfG
--> stefan <--

Hi Stefan,
I mean, i want to capture text, if user double click on it. I can
capture it with javascript but, i cant sent it dictionary form. (My
dictionary form can give word mean).

I want to capture word (which user double click) and sent it another
form.

Thanks.

Öznur
 
S

Stefan Hoffmann

hi oz,
I mean, i want to capture text, if user double click on it. I can
capture it with javascript but, i cant sent it dictionary form. (My
dictionary form can give word mean).
Your JavaScript must load a new page, e.g. redirect to
http://dict/captured_word.

You can handle this redirect in the webBrowser1_Navigating event. You
just must cancel in this event the navigation and do what you want with
your url:

namespace WindowsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("c:/temp/test.html");
}

private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
e.Cancel = (e.Url.ToString() != "file:///C:/Temp/test.html");
if (e.Cancel)
MessageBox.Show(e.Url.ToString());
}
}
}


My test.html:
<html><body><a href="http://dict?captured">click</a></body></html>

mfG
--> stefan <--
 
O

oz

Thanks your reply. but i cant use html file. because my word mean in
database, not in seperately html file.

My database structure like this:

tblBooks
-------
intBookId (INT)
strBookName (NVARCHAR(30))

tblPages
--------
intPageId (INT)
intBookId (INT)
strPageContent (NVARCHAR(MAX))


tblWords
------
intWordId (INT)
intPageId (INT)
strWord (NVARCHAR(30))
strMean( NVARCHAR(100))

strPageContent is html content, like this : "<b>Hi, my name is Öznur!
<b>"
I show this content in webBrowser control (windows application).


strWord (in tblWords table) is has every word, like :

"Hi" , "name", "Öznur"

strMean (in tblWords table) is has every word mean, like,

"used in greating", "reputed", "some body has light".

If user double click webBrowser content part; like "Hi", the other
windows form (Dictionary.cs) must appear (like popup) and say : "used
in greating". in the same way, if user double click over "Öznur" word,
the other windows form (Dictionary.cs) appear and say: "some body has
light", and so on.

In other words, i cant use html file or <a> tag or link style or other
web page, because database binding. i cant use web application so web
form, because user does not have iis.

I obtain the word which double click with javascript, but i cant
create some windows form (dictionary.cs) via javascript. Therefor, i
cant show word mean on dictionary.cs form.

Thanks.

Öznur
 
O

oz

if i create a form or write server code in javascript, i can create a
form (dictionary.cs) and show word mean on form. but how?

may be another way is exist, but i dont know.

if you know other way for this situation, please share with me.

Thank you again.

Öznur
 
S

Stefan Hoffmann

hi oz,

Either I don't understand your problem or you don't understand my solution.

You are displaying some database generated content in a WebBroser
control on a Windows Forms application?
This content uses JavaScript to extract a marked word?
I obtain the word which double click with javascript, but i cant
create some windows form (dictionary.cs) via javascript.
When you have your word captured with JavaScript, use JavaScript to
redirect your page.
The redirection can be handled with the code i have posted to open your
other form.


mfG
--> stefan <--
 
O

oz

hi,

control on a Windows Forms application?

yes. my windows form bind database and show html content in webBrowser
on Windows form.


yes, use javascript, and this javascript can capture word (not on link
which word, only double click the word (clear), and obtain the word.).
but i can not create windows form in javascript and i cant send the
word i obtain via javascript.

your source code, give me messagebox (or can create windows form) but,
it use link in html and therefor create new server object. my html
content does not have any link with word.

only i found this method (with javascipt), may be another way exist,
may be javascript method is not necessary but i cant found it.

do you know babylon ? if you use this program, you can see my
situation. Press any word on content, babylon can open the popup, and
give me word's mean. I try to do like this.

thanks.

Öznur
 
S

Stefan Hoffmann

hi oz,
yes, use javascript, and this javascript can capture word (not on link
which word, only double click the word (clear), and obtain the word.).
but i can not create windows form in javascript and i cant send the
word i obtain via javascript.
You shouldn't create a form in JavaScript. Just generate a redirect in it.

http://www.tizag.com/javascriptT/javascriptredirect.php

<script type="text/javascript">
<!--
window.location = "http://www.google.com/"
//-->
</script>

This redirect is handled by my code.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top