You expose either the property or method you need via a public member.
By 'set its navigation', you can either mean set the URL, or navigate to some URL. In the first case, you could do this in Form2
Code:
public string WebbrowserUrl
{
get { return webBrowser1.Url; }
set { webBrowser1.Url = value; }
}
and this in Form1
Code:
Form2 f = new Form2();
f.Show();
f.WebbrowserUrl = "www.google.com";
In the second case, instead of creating a property you create a method. In Form2:
Code:
public void Navigate(string url)
{
webBrowser1.Navigate(url);
}
and in Form1:
Code:
Form2 f = new Form2();
f.Show();
f.Navigate("www.google.com");
In both cases, the property/method simply acts as a 'pass-through' to the private (inaccessible) web browser. The Url property simply returns the Url property of the web browser in its getter, and sets the value of the Url property of the web browser in the setter. The Navigate method simply calls the Navigate method on the web browser.
You cannot access the webbrowser directly from Form1, because it is declared private by default. You could declare it public instead, then you could use it directly, but I advice you to leave it private. If you only need to ever set the Url property, then only expose the Url property instead of the entire web browser object. Only if you need nearly every single property of the web browser could you consider exposing the entire webbrowser (otherwise you'd have dozens of these 'pass-through' properties).