How to let user set his home page in c# visual studio 2008?
I am creating a browser and I am supposed to provide an option for the user to set his homepage. I have created a tabbed开发者_如何学Go browser. Can anyone suggest me what to do?
Thank you
Put a field in your configuration for the browser called UserHomePage, and be able to store a URL in it.
When the user is on a website, and uses your menu/buttons to Set as HomePage
, store the current URL in the UserHomePage field.
When the browser is first opened, go to that URL.
If someone clicks the HOME button, go to that URL.
Setup a properties window with a text box asking for user's home page url; save it somewhere accessible in future. When user click on the Home button of your browser, retrieve the url and navigate to that site.
//declared public string "sString" //"Set homepage" is a tool strip. Stored textboxURL in sString. //Home is a tool strip button.Navigated it to sString.
public string sString;
private void setHomepageToolStripMenuItem_Click(object sender, EventArgs e)
{
sString = urlTextBox.Text;
string home = "http://" + sString;
}
private void homeToolStripButton_Click(object sender, EventArgs e)
{
((WebBrowser)tabControl.SelectedTab.Controls[0]).Navigate(sString);
}
Thank you "Raj More" and "KMan" for helping me.
精彩评论