Michael
Michael

Reputation: 13616

Conversion from string "FalseTrue" to type 'Boolean' is not valid -Exception

Here is my VB Net code:

Public Class Form1

   Dim hue As Single

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles      Button1.Click
   Dim hueMin As Single = 205
     Dim hueMax As Single = 259

            If (hue > hueMin) & (hue < hueMax) Then

                 bmp.SetPixel(Xcor, Ycor, Color.Black)

             End If
   End Sub

End Class

I get in this row:

            If (hue > hueMin) & (hue < hueMax) Then

this exception:

{"Conversion from string "FalseTrue" to type 'Boolean' is not valid."}

Any idea how ca i fix the code? Thank you in advance.

Upvotes: 1

Views: 1554

Answers (1)

Steve
Steve

Reputation: 216302

the right test should be

If (hue > hueMin) AndAlso (hue < hueMax) Then 
                   ^^^^

the & in VB.Net is the String concatenation operator.

Upvotes: 5

Related Questions