tags:

views:

47

answers:

2

hi

how to do this:

when i press the button - the website will open.

this website has 2 textbox (textbox1 and textbox2).

i need to insert to textbox1 - "hello" and to textbox2 - "word"

(the text that i insert is only on my computer - only on my screen)

how to do it in C# Winforms ?

thank's in advance

+1  A: 

Assuming I've understood this correctly, you just need to pass the text box values to your web page either using HTTP POST or HTTP GET, and then retrieve the values in the code of your choice (e.g. ASP.Net).

So, for HTTP GET, your Win Forms application calls this page, passing the values in:

"http://www.example.com/page.aspx?param1=value1&param2=value2"

and you can then read those values from the QueryString and do something with them:

TextBox1.Text = Request.QueryString["param1"];

There are loads of other ways of doing similar things, including using JavaScript.

TimS
thank's for the help, but how to use it ? can i get any sample code ?
Gold
Should be very simple to do without sample code. If you've not done that kind of basic Query String stuff check out http://www.w3schools.com/ as a good place to start learning web development.
TimS
A: 

If you are referring to an actual website as in you are launching a browser, you can use the Web Browser Control to launch the browser and manipulate the elements, or execute js.

using(WebBrowser browser = new WebBrowser())
{
    browser.Url = new Uri("http://www.google.com");
    HtmlElement textBox = webBrowser1.Document.All["textbox1"];
    if (textBox1 != null)
    {
        textBox1.InnerText = "Hello";
    }
    //repeate for textBox2....
}

If you are talking about a winform app and textboxes on it you would do something like this:

textbox1.Text = "hello";
textbox2.Text = "word";
pageinventor