Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2012 Help with Boolean Error

$
0
0
Code:

Private Sub CmbTieSize_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbTieSize.SelectedIndexChanged
        LblTieColorDisplay.Text = CmbTieSize.SelectedValue.ToString

        If CmbTieSize.Text = "FTB4" Or "FTR12" Then
            GroupBox1.Height = "67"
        Else
            GroupBox1.Height = "120"
        End If
    End Sub

'When I added the "Or" I received a message stating "InvalidCastException was unhandled by user code" Conversion from string "FTR12" to type 'Boolean' is not valid.
I understand that anything within a quote is considered a string. I would much rather consolidate my code since if the user chooses certain product as shown above the same action will occur. Hope that makes sense. Thank you for the guidance.

Viewing all articles
Browse latest Browse all 42215

Trending Articles