See if this helps.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With TextBox1
If Not .Text = "" Then '// check if not empty.
Dim myCoolIDletters As String = "" '// new String to get all letters at beginning of ID.
For i As Integer = 0 To .Text.Length - 1 '// loop until all letters located and added to String.
If Not IsNumeric(.Text(i)) Then myCoolIDletters &= .Text(i) Else Exit For
Next
'// set letters back and increase the #+1, with the format of 4#'s, as "0000".
.Text = myCoolIDletters & (CInt(.Text.Substring(myCoolIDletters.Length)) + 1).ToString("0000")
End If
End With
End Sub
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384