Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

Accessing a web form control from a different web forms code behind.

I am new to Winform programming and need help figuring something out.

Basically I have two winforms in my project(Winform1 and Winform2).
The first one has a button control on it. The second has a WebBrowser control on it.
The control is named "webBrowser1"
 

When the button on the first Windows form is pressed, in the code behind for that button,
I want to display the second web form which has the WebBrowser control on it. Before
I display it though, I need to access the WebBrowser control and set the URL for it.
So my question is how do I access the WebBrowser control from the code behind of the first web form.

This is as far as I got:


// Button click event for Form1
private void button1_Click(object sender, EventArgs e)
{

   Form2 frm = new Form2();
   // Now how do I access the control webBrowser1 and set the URL for it?
   



   frm.ShowDialog();

}
ASKER CERTIFIED SOLUTION
Avatar of haxkmav
haxkmav

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brgdotnet

ASKER

Special thanks, it worked great.