I am thinking your approach is not completely robust. Without checking I imagine the 123.45 will return true to isnumeric which I imagine you don't want.
Personally, I am not a fan of masked text boxes because they are not that user friendly but it is a quick and easy way to achieve what you want. Use a mask of "0000000A" and set the ASCII only property to true.
If you want to test the 8th character to see if it is a letter here is the code
Dim aChar As String
aChar = UCase$(Mid$(TextBox3.Text, 8, 1))
If aChar >= "A" And aChar <= "Z" Then
Label4.Text = "The 8th char is a letter"
Label4.Text = "The 8th char is not a letter"
yes, ur right again :) shit. i have to use yr code then ^^ lol, i never thought of testing with !@#$ etc
This will correctly test to make sure you only have letters - no numbers or symbols allowed.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hold As String
hold = Strings.Right(textbox1.Text.ToUpper, 1)
If hold Like "[A-Z]" Then ' [!A-Z] would be use for "not in this set"
MsgBox("its a letter")
MsgBox("its not a letter")
I knew about this from creating a "hangman" game for may daughter - I had to make sure she didn't trick me by using numbers or hyphens! (Chris might think this is new-fangled!)
And Chris is right - you should also validate that the correct number of characters are entered, and be careful of upper and lower case!
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...