Jack Jack - 4 months ago 14
Vb.net Question

how do I make a web browser display html in vb?

So I have a web browser, and it needs to login using html code that will get modified by textbox inputs. I know how to use the textbox inputs to modify the code, but how can I make the web browser run the code?

The code:

<form action="https://api.roblox.com/login/v1" method="post">
<input name="username" value="">
<input name="password" value="">
<button>Login</button>



Answer

so from what i can see there are three ways you can do this :

1) You can make the vb form enter the inputs required and submit the form in the background according to user inputs (which you have mentioned you already now about).However heres some code to do it :

WebBrowser1.Document.GetElementById("username").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("password").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.Forms(1).InvokeMember("submit")

2) You could also just save that html code as a html webpage and host it on a domain and then use this code to navigate it to your html page WebBrowser1.Navigate('http://www.yourhtmldomain.com')

3) If you want to run the html file from a local source lets say where the exe file for the web browser is located we would use this line of code ;

WebBrowser1.Navigate App.Path & "/mysite.html"
Comments