-1

I am pretty new to VB. I have a text box where I scan randow barcodes into a text box which contain letters and numbers how do I split this so that it reads as two separate lines in the same text box ex: this how it looks when its first scanned ZM123456789123 I want it to look like this M123456 789123 I was able to remove the letter Z which means nothing but I am stuck separating the text

Private Sub TextBox29_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox29.TextChanged
    If String.IsNullOrEmpty(TextBox29.Text) = True Then
        Exit Sub
    End If
    'ZM123456I1234
    TextBox29.Text = TextBox29.Text.ToUpper.Replace("Z", Nothing)
Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Try:-

TextBox29.Text = TextBox29.Text.Substring(1).Insert(7, " ")

The substring strips off the first character, the insert adds a space at the 7th (zero based) character position.

dav1dsm1th
  • 1,687
  • 2
  • 20
  • 24