2013-11-15 38 views
-1

我对VB很新颖。我有一个文本框,我将randow条形码扫描到一个包含字母和数字的文本框中,我如何拆分它以便它在同一个文本框中作为两个单独的行读取: ex:这是第一次扫描时的外观样式 ZM123456789123 我希望它看起来像这样 M123456 我能够除去字母Z,这意味着什么,但我坚持分隔文本如何将随机扫描的文本分成两行不同

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) 
+0

你想要单独的行 - 或只是一个空间添加? – dav1dsm1th

+0

http://stackoverflow.com/questions/2203710/is-there-n-equivalent-in-vbscript – Levi

回答

0

尝试: -

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

substring剥离第一个字符,insert在第七个(基于零的)字符位置添加一个空格。