views:

44

answers:

3

Hi,

I have a method that saves form controls data to a text file, including its text. IF a label has multiple lines, this breaks the text file writing multiple lines to it.

I was instructed to simply ignore multiple-line labels and don't include it in the file, but I don't know how to check whether or not a label has can multiple lines or not so I can throw in an 'if' statement.

Thanks!

+1  A: 

Hi there.

You can check for new lines in the label like this:

If Not lblText.Text.Contains(Environment.NewLine) Then

So if the label has a newline, igonre it.

Cheers. Jas.

Jason Evans
+1  A: 

Test for something like this

Label1.Text.Contains(Environment.NewLine)

Environment.NewLine Property

astander
A: 
myLabel.Text.Contains(vbCrlf)

Sorry, VB.net isn't my first language.

shahkalpesh