简体   繁体   English

使文本框类型变成文本框?

[英]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? 我是VB.NET的新手,我想知道如何在应用程序上的文本框中键入内容,然后将其键入网站文本框并通过按钮提交文本中的内容? I am using visual studio 2008. 我正在使用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)? 更好的建议:您是否考虑过让VB.NET应用程序直接将表单/请求提交到Web服务器并删去中间人(浏览器),而不是尝试通过“ voodoo”控制浏览器?

I'm assuming you're trying to POST data to a web form from some other application. 我假设您正在尝试将数据从其他应用程序发布到Web表单。 Check this out; 检查这个出来; it's in C# but you can translate it to VB.NET. 它在C#中,但是您可以将其转换为VB.NET。 It uses a WebBrowser control and the SetAttribute method to set input values on the web form. 它使用WebBrowser控件和SetAttribute方法在Web窗体上设置输入值。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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