热门搜索 :
考研考公

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
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com
Top