简体   繁体   中英

Making Textbox type into a textbox?

I'm a noob to VB.NET and I was wondering how to make something you type into a textbox on the application type that text into a website textbox and submit whats in the textbox by pressing a button? I am using visual studio 2008.

That is a little tricky to do, but it is possible. However, without more details on the specific browser or what you are trying to copy over, you aren't going to get a lot of answers on here.

Better Suggestion: Have you considered instead of trying to control the browser via "voodoo", that you might just have your VB.NET application submit the form/request directly to the web server and cut out the middle-man (the browser)?

I'm assuming you're trying to POST data to a web form from some other application. Check this out; it's in C# but you can translate it to VB.NET. It uses a WebBrowser control and the SetAttribute method to set input values on the web form.

// C#
WebBrowser browser;
...
browser.Document.GetElementById("username").SetAttribute("value", "MyUsername");
...
form.InvokeMember("submit");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM