| 关键的问题就是如何在Text中查找B1/B2等的字符串而已,如果B1、B2是固定的两个字符,那么只要每次在Text中获取两个字符,然后比较是那个即可。 我安装你给的述说做了个例子,你只要新建一个工程,添加两个textbox,名称默认为text1、text2即可,再加一个command1,然后粘帖下面的代码试试:
 
 代码:
 Option Explicit
 
 Private Sub Command1_Click()
 Dim strTemp As String
 Dim strResult As String
 Dim strLen As Long
 Dim i  As Integer
 
 '假定是每次两个字符,算算到底有多少个
 strLen = Len(Text1.Text) / 2
 i = 1
 
 While i <= strLen
 '每次获取两个字符
 strTemp = Mid(Text1.Text, i, 2)
 
 '看看到底是属于那类的
 Select Case strTemp
 Case "B1"
 strResult = strResult + "88"
 
 Case "B2"
 strResult = strResult + "99"
 
 Case "B3"
 strResult = strResult + "00"
 
 Case "B4"
 strResult = strResult + "11"
 End Select
 i = i + 2
 Wend
 
 '全部获取完后就显示了
 Text2.Text = strResult
 End Sub
 
 Private Sub Form_Load()
 
 '测试之用
 Text1.Text = "B2B4B1B2B3B1B4B2"
 End Sub
 
 
 
 
 
 
 |