Hello all.
At first I know the basics of C++ but only on console applications. Now I'm trying to make form application with WebBrowser.
I'm using Microsoft Visual Studio 2008.
Here is my problem:
I create new project (windows forms application) and on design tab I add WebBrowser and Button. Now I know that if I double click on button it will take me on to the Form1.h and if I want to navigate WebBrowser I just type
this->webbrowser1->Navigate("www.google.com"); ..... and it works.
But what about if I want to navigate webbrowser from the main function or from other function? Whatever I do it says that webbrowser1 is not declared. So how can I declare this webbrowser1 in main function?
And where the main code of this forms application should be? In form1.h ???
Thanks for any help you can give.
[Beginner question] Something about webBrowser and Form applications
Started by Doctor, Apr 26 2010 01:20 AM
3 replies to this topic
#1
Posted 26 April 2010 - 01:20 AM
|
|
|
#2
Posted 26 April 2010 - 01:33 AM
This probably belongs in the Managed C++ forum :)
#3
Posted 26 April 2010 - 04:28 AM
#4
Posted 19 June 2010 - 05:13 PM
Yes, you should be editing that in Form1.h. Just Double click on button "Go" or anything that you want.
Then you should see something like Private: Void Button1_Click(........){
//You can add your code here.
//whenever you click on Button1, this code is executed.
//so if you have textBox1 for putting address, you can do something like this
this->webBrowser1->Navigate(textBox1->text);
//i think it should work.
}
also, you shouldn't touch anything in Main.cpp, because it basically just calls Form1, so you can do what you want in Form1
Then you should see something like Private: Void Button1_Click(........){
//You can add your code here.
//whenever you click on Button1, this code is executed.
//so if you have textBox1 for putting address, you can do something like this
this->webBrowser1->Navigate(textBox1->text);
//i think it should work.
}
also, you shouldn't touch anything in Main.cpp, because it basically just calls Form1, so you can do what you want in Form1


Sign In
Create Account


Back to top









