Please help.
Option Explicit On
Option Strict On
Option Infer Off
Public Class MainForm
Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
Private Sub itemTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles itemTextBox.Enter
itemTextBox.SelectAll()
End Sub
Private Sub itemTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles itemTextBox.TextChanged
colorLabel.Text = String.Empty
End Sub
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub displayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayButton.Click
Dim characters As String
Dim isCharactersValid As Boolean
characters = itemTextBox.Text.ToUpper
If characters.Length = 5 Then
If characters Like "##[BGRW]##" Then
isCharactersValid = True
If isCharactersValid = True Then
Select Case characters
Case "B"
colorLabel.Text = "Blue"
Case "G"
colorLabel.Text = "Green"
Case "R"
colorLabel.Text = "Red"
Case "W"
colorLabel.Text = "White"
End Select
End If
Else
MessageBox.Show("Third character must contain a (b,g,r or w).", _
"Error", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
End If
Else
MessageBox.Show("Please enter the proper 5 character format.", _
"Error", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
End If
End Sub
End Class

New Topic/Question
Reply




MultiQuote





|