Click here to Skip to main content
14,700,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have a intranet web page and a windows form application also.
I need to change a text box value on the windows form application, by getting a value from web page, and with a button on the page. How Can I do this? I need your help as soon as possible..
Thank you very much in advance

For Example;

Web Page = 12345 (written on a column) -> send to form (with pressıng a button)
Windows Form = 12345 -> Textbox value (first it's empty then we fill this via getting value from web page)

I decide to do web page (server side) writes the value to a somewhere inthe registry and client app should read from there.
I did this with the following script but it doesnt work when I deploy the code to the server.
Can you help me I need to finish it today:(

<script language="javascript" type="text/javascript">
function ReadRegistry() {
var WshShell;
var Key;
try {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.RegWrite("HKEY_CURRENT_USER\\Software\\Clients\\id", 12345);
Key = WshShell.RegRead("HKEY_CURRENT_USER\\Software\\Clients\\id");
} catch (e) {
Key = '';
Updated 24-Nov-11 3:51am
elgaabeb 24-Nov-11 4:00am
I think that the name of the Question should be changed.

Your best bet would be to use an intermediary file, like a text or xml file. When the user enters something in the textbox in the web page and clicks the button, the web page can update the text file. The winforms application can have a timer which periodically checks the text file to see if it has been updated, and if so, it can update it's own controls.

Hope this helps
Zubair Alie 24-Nov-11 8:17am
timer isn't a good use FileWatcher.. as the file get modified... you read the file
That seems good idea, but I want to do it in real time, some people told me that,
findwindow(), childwindow() and setwindowtext() function I need to do this.
But I could not manage to figure that out. Maybe what they told is better way to solve.
elgaabeb 24-Nov-11 3:54am
I think also that this is the way to do it correctly, you can even grab components (textField) inside your target window and set its text value, just look at windows API which make you able to handle graphic components (Windows).
Hi ,

I think also that this is the way to do it correctly, you can even grab components (textField) inside your target window and set its text value, just look at windows API which make you able to handle graphic components (Windows).

this example would help you to begin :

Retrieving Conversations from MSN Messenger[^]

look at msdn to see how to use this function and which DLL you should load :

EnumChildWindow msdn ref[^]

Here is an article about how to invoke dll functions on C# :
Calling API functions using C#[^]

changing registry key :

Read, write and delete from registry with C#[^]

best regards.
LillyM 24-Nov-11 4:42am
This is c++, I do understand nothing from this language actually.
Do you have any other example. I did many search, but I didnt find any.

Thanks a lot again
elgaabeb 24-Nov-11 4:57am
You will use the same windows native functions (API), but you will call them from a c# program. I've updated my answer according to your need, look if it is more helpfull for you.
LillyM 24-Nov-11 7:31am
Hello agaian elgaabeb,

Thank you very much for your help, but it comes to me so confusing and I talked to my manager and he accepted to using client's registry key to change value.

How can I create and write to client's registry key?

elgaabeb 24-Nov-11 7:43am
U are welcome. I've added a link to an article which do this. have a look at it. Could you change your Question to have a more helpfull solution propositions.
LillyM 24-Nov-11 8:52am
I updated the question, can you review my latest situation again..

thanks a lot
The javascript that I sent yesterday has been working, the only problem string and int values.

Thanks to everyone

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900