0
votes
        If result12.Contains("""Status"" value=""0""") Then
        TextBox1.Text = "Antique Lights are On" And
        Label19.ForeColor = Color.Red
    End If    

I can not figure out what I'm doing wrong here. I just want the text box to show "Antique Lights are On". I keep getting an error about converting to Boolean. Shouldn't it stay string? I'm using Visual Studio 2013 and creating a windows form.

2
What is that AND at the end of the TextBox1.Text line? - Steve
I have it changing the text color as well. Do I not need the And? - James Roth
Despite your 'noobishness', I applaud you for using Option Strict. Well done that man, keep up the good work! - The Blue Dog
No you don't. Just make it a seperate line inside of your conditional statement. - Mark Hall

2 Answers

3
votes

The problem is this:

TextBox1.Text = "Antique Lights are On" And
Label19.ForeColor = Color.Red

Starting in VS 2012, you didn't have to include the underscore for a line continuation in VB.NET.

So this is interpreted as boolean statement:

"Antique Lights are On" And Label19.ForeColor = Color.Red

Since "Antique Lights are On" isn't a valid boolean statement you get the error.

0
votes

You do not need the 'And' to process the next line.

'And' in this case is trying to do a boolean conditional, which doesn't make sense in this context.