Hi All,
I have a webBrowser control in my C# winform app. This works beautifully and I have a textBox control (called txtAddress) as the address bar. This also works beautifully apart from one small detail.
I have noticed that when typing in a URL to navigate to I have put http:// at the beginning of the address. This is not a problem for me but I know that some of our users will only put the www at beginning of the addy.
To get around this problem I thought about composing a method that invokes before my navigating method that checks to see if http:// is at the beginning of any text inputted by the user into txtAddress. If it is not present then it will put http:// at the beginning of the text and hey-presto all navigation will work sweet as a nut.
Only problem is, being a relative newbie to C#, I'm struggling with it. The code for this method I have so far is as follows:
private void CheckHttp()
{
if (txtAddress.Text.IndexOf("http://") == -1)
{
// Code here to append http:// at the beginning of the text.
}
else
// Code here not to append text
}
Any help on this would be very much appreciated.
Thanks for reading

Appending text in textBox control
Agarwal
This might help:
private void CheckHttp(){
if (txtAddress.Text.IndexOf("http://") == -1){
//txtAddress.Text = "http://" + txtAddress.Text; //ORtxtAddress.Text =
String.Format("http://{0}", txtAddress.Text);}
else{
}
}
HTH
MS Student
Thanks Craig,
Thats works like a dream.
Many thanks