Public Class Form2
Dim i As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMainMenu.Click
Me.Close()
End Sub
Private Sub btnEnterPatient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterPatient.Click
ReDim Preserve Names(0 To i)
Names(i) = txtPatientName.Text
ReDim Preserve Heights(0 To i)
Heights(i) = txtPatientHeight.Text
ReDim Preserve Weights(0 To i)
Weights(i) = txtPatientWeight.Text
i = i + 1
End Sub
End Class
这是我的代码,当我单击按钮将数据输入三个数组时,但是当我单击按钮时i不会增加。此外,如果我没有在高度或重量文本框中输入任何内容并按下按钮,我会收到错误:从字符串“”转换为“整数”类型无效。
这是什么问题? 感谢