I am trying to write a program with Visual Basic 2010.
The problem is when I load an “Example” with multi-lines it takes forever! I don’t mind it taking a while but it would be nice if there was a faster way.
'Open Sample Page
Textbox1.Text =
"<html>" + Environment.NewLine +
"<!- Example ->" + Environment.NewLine +
"<h1 align='center'>" + Environment.NewLine +
"Page Title" + Environment.NewLine +
"</h1>" + Environment.NewLine +
"<h3>" + Environment.NewLine +
"Subject" + Environment.NewLine +
"</h3>" + Environment.NewLine +
"<p>" + Environment.NewLine +
"Paragraph with lots of text in it.<br>" + Environment.NewLine +
"<a href='http://www.google.com/'>" + Environment.NewLine +
"Links" + Environment.NewLine +
"</a>" + Environment.NewLine +
"...And Different lines." + Environment.NewLine +
"</p>" + Environment.NewLine +
"</html>"
Thanks Guys but this guy on yahoo! helped me..
VB uses can use ampersand(&) or a plus sign (+) operator for concatenation.
The plus(+) operator is also used for addition while the ampersand(&) is only used for concatenation.
When you use the + VB must figure out which operation you are trying to perform, addition or concatenation. Most of the time VB guesses right but there are time when VB can guess wrong and cause a bug. Also since you are using the plus sign VB has to determine which operation needs to be performed.
I recommend that you use the ampersand(&) whenever you are trying to do concatenation and ONLY use the plus sign(+) for addition.
Try replacings all of the +’s with &’s so that VB doesn’t waste time in determing if addition or concatenation needs to be done. By using an ampersand you leave no doubt that you want to do concatenation
A quick way to do that edit is to highlight the text and press CTRL+H to do a find and replace on the selected text and replace + with &