在VB中,怎么用MID函数,抓取文本框中的数据
发布网友
发布时间:2022-05-02 14:09
我来回答
共4个回答
热心网友
时间:2022-06-20 10:18
Dim a(0 To 100) As String, i, j As Long
For i = 1 To Len(Text1) Step 2 '循环取出字符
If i <= 100 Then a((i - 1) / 2) = Mid(Text1, i, 2) 'Mid(原字符,从什么位置开始读取,读取字符的个数)
Next
For j = 0 To (i - 1) / 2 - 1 '显示到窗口
Print a(j)
Next
Print i
Print Len(Text1)
'结果为a(0)=12 a(1)=34 a(2)=56 a(3)=77 a(4)=89,正是你要的结果
热心网友
时间:2022-06-20 10:18
Private Sub Command1_Click()
Dim I As Long, J as long, a(0 To 100) As Byte
For I = 1 To Len(Text1.Text) Step 2
a(j) = Val(Mid(Text1.Text, I, 2))
j=j+1
Next
End Sub
Private Sub Form_Load()
Text1.Text = "12345677891"
End Sub
热心网友
时间:2022-06-20 10:19
Private Sub Command1_Click()
strText = "12345677891"
Dim a(0 To 100) As Byte
For i = 0 To ((Len(strText) - 1) / 2)
a(i) = Val(Mid(strText, i * 2 + 1, 2))
Next
End Sub
热心网友
时间:2022-06-20 10:19
str1="1234567789"
for i = 1 to len(str1) step 2
print mid(str1,i,2)
next i