Hello Daniwebber's,
I am developing a web browser. When the user clicks "Go" or "Enter" it will navigate to the website, however if it doesn't contain popular website keywords such as "http://" then I know they didn't actually want to go to a website. Then I would have it perform a google search instead, however I need to know ?how to check a textbox value?.
I want to check if when toolStripButton3_Click ("Go" button) is clicked if adrBarTextBox (which is a textbox) contains a value, such as "http", "www", "/", "//", ".", "com", "org", "net". If it doesn't contain that value, I want to perform a google search (which I know how to do).
Sample code:
private void toolStripButton3_Click(object sender, EventArgs e)
{
// This is the function called when the user clicks "GO" to start going to the website
// I want to check to see if the textbox contains "http", "www", ".", "com", "org", "net", "//", "/"
// The search bar's name is: adrBarTextBox
if() { // adrBarTextBox.value = "www" does not work.
// if it contains "www", we know they actually meant to go to a website:
getCurrentBrowser().Navigate(adrBarTextBox.Text); // Go to where they asked
}
else {
// Else, we think they meant to search something:
getCurrentBrowser().Navigate("http://google.com/search?q=" + adrBarTextBox.Text); // Search for keywords on google
}
}
All help is appreciated. I have searched MSDN & daniweb references, and came up with nothing about checking inside a textbox for certain values.