C#怎样让数组接收textbox的text内容

2025-01-01 02:31:38
推荐回答(3个)
回答1:

///假设数组是字符串数组;如果是其他类型的数组,转化一下就可以用了

数组[序号] = textbox.Text

回答2:

text.tostring().tochararray()

回答3:

Private Sub Command1_Click()
Dim arr() As Integer, tmp1, tmp2, tmp3 As String
tmp1 = Split(Text1, vbCrLf)
tmp2 = Split(tmp1(0), "x")
ReDim arr(UBound(tmp1), UBound(tmp2))
For i = 0 To UBound(tmp1)
For j = 0 To UBound(tmp2)
arr(i, j) = Val(Split(tmp1(i), "x")(j))
Next
Next

'arr你要的二维数组

End Sub

Private Sub Form_Load()
Text1.Text = "1 x2x3y" & vbCrLf & "2 x3x4y" & vbCrLf & "3 x4x5y"
End Sub