有10个文本框 有一字符串"1 2 3 4 5 6 7 8 9"
text1.text=1
text2.text=1
text3.text=3
...text8.text=8
text9.text=""
text10.text=9这其中每个数字都是用空格分开的 但 8和9之间只有2个空格 所以text9.text="" (""为空,不是引号)用这个例子就是想说明白这一点 如果是有连续2个空格的话 那么读到那里的那个 text?.text="" 现在有50个文本框 有一字符串"dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd ...."text1.text=dsa
text2.text=dsf
...
text50.text=..
应该怎么编这个程序谢了。
text1.text=1
text2.text=1
text3.text=3
...text8.text=8
text9.text=""
text10.text=9这其中每个数字都是用空格分开的 但 8和9之间只有2个空格 所以text9.text="" (""为空,不是引号)用这个例子就是想说明白这一点 如果是有连续2个空格的话 那么读到那里的那个 text?.text="" 现在有50个文本框 有一字符串"dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd ...."text1.text=dsa
text2.text=dsf
...
text50.text=..
应该怎么编这个程序谢了。
aa="dsf dfg gfg "
strTmp = Split(strLine, " ")
text1.text=strTmp(0)
text2.text=strTmp(1)
text3.text=strTmp(2)
Private Sub Command1_Click()
Dim str As String
Dim arr() As String
Dim i As Long str = "1 5 6 8 9 a d AD" 'text 个数要和字符串数一样
arr = Split(str, " ")
For i = 0 To UBound(arr)
Text1(i) = arr(i)
Next i
End Sub
Private Sub Command1_Click()
Dim str As String
Dim arr() As String
Dim i As Long str = ""dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd ...."" 'text 个数要和字符串数一样
arr = Split(str, " ")
For i = 0 To UBound(arr)
if i <>0 then load text1(i)
Text1(i) = arr(i)
Next i
End Sub
Private Sub Command1_Click()
Dim str As String
Dim arr() As String
Dim i As Long
dim K as string
str = ""dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd ...."" 'text 个数要和字符串数一样
arr = Split(str, " ")
For i = 1 To UBound(arr)+1
K = "text" & Trim(i)
Me.Controls(K).Caption = arr(i)
Next i End Sub
Private Sub Command1_Click()
Dim str As String
Dim arr() As String
Dim i As Long
dim K as string
str = ""dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd ...."" 'text 个数要和字符串数一样
arr = Split(str, " ")
For i = 1 To UBound(arr)+1
K = "text" & Trim(i)
Me.Controls(K).Caption = arr(i-1)
Next i End Sub
Dim s
Dim a As Object
For Each a In Me.Controls
If TypeOf a Is TextBox Then
s = Mid(a.Name, 5, Len(a.Name) - 4)
a.Text = s
End If
Next
End Sub
Private Sub Command2_Click()
Dim s
Dim a As Object
iStr = "dsa dsf gfg gfd rer dfd fdsf dfsf erer fsdfd "
s = Split(iStr, " ")
For Each a In Me.Controls
If TypeOf a Is TextBox Then
L = Mid(a.Name, 5, Len(a.Name) - 4)
a.Text = s(L - 1)
End If
Next
End Sub