vb把text中数据储存到二维数组
发布网友
发布时间:2024-10-24 17:06
我来回答
共1个回答
热心网友
时间:2024-10-24 17:15
我是在vb里调试通过的,哎,麻烦死了
Private Sub Command1_Click()
Dim Strtemp As String, A() As Double '读入数据到数字a中
Dim X As Variant, uu As Integer
Strtemp = Text1
X = Split(Strtemp, ",") '
uu = UBound(X)
ReDim A(uu - 1, 0 To 1) As Double
Dim St As Integer, Ed As Integer
St = 0
Do While St < Len(Strtemp)
Ed = InStr(St + 1, Strtemp, vbCrLf)
If Ed > 0 Then
Strtemp = Mid(Strtemp, St + 1, Ed - St)
A(i, 0) = Left(Strtemp, InStr(1, Strtemp, ",") - 1)
A(i, 1) = Right(Strtemp, Len(Strtemp) - InStr(1, Strtemp, ","))
i = i + 1
St = Ed
Else: Exit Do
End If
Loop
End Sub
热心网友
时间:2024-10-24 17:18
我是在vb里调试通过的,哎,麻烦死了
Private Sub Command1_Click()
Dim Strtemp As String, A() As Double '读入数据到数字a中
Dim X As Variant, uu As Integer
Strtemp = Text1
X = Split(Strtemp, ",") '
uu = UBound(X)
ReDim A(uu - 1, 0 To 1) As Double
Dim St As Integer, Ed As Integer
St = 0
Do While St < Len(Strtemp)
Ed = InStr(St + 1, Strtemp, vbCrLf)
If Ed > 0 Then
Strtemp = Mid(Strtemp, St + 1, Ed - St)
A(i, 0) = Left(Strtemp, InStr(1, Strtemp, ",") - 1)
A(i, 1) = Right(Strtemp, Len(Strtemp) - InStr(1, Strtemp, ","))
i = i + 1
St = Ed
Else: Exit Do
End If
Loop
End Sub