1
나는이 간단한 프로그램을 통해 오류가 발생했습니다. 나는 전체 이름, 주소를 메시지 박스하려고하고 나에게 그것을 정수로 주소를 변환 할 수 없다는 오류를주는 유지 citystatezip 때문자열에서 정수로의 변환 vb.net
Private Sub btnProcess_Click(sender As Object, e As EventArgs) Handles btnProcess.Click
Dim FullName As String = ""
Dim Address As String = ""
Dim CityStateZip As String = ""
Dim Stoves As Integer
Dim Refrigerators As Integer
Dim Dishwashers As Integer
INPUT_DATA(FullName, Address, CityStateZip, Stoves, Refrigerators, Dishwashers)
MsgBox(FullName, Address, CityStateZip)
End Sub
Sub INPUT_DATA(ByRef Name As String, ByRef Address As String, ByRef CSZ As String, ByRef Stoves As Integer, ByRef Refrigerators As Integer, ByRef Dishwashers As Integer)
If txtName.Text = "" Then
Name = InputBox("Please enter a name!")
Else
Name = txtName.Text
End If
If txtAddress.Text = "" Then
Address = InputBox("Please enter an address!")
Else
Address = txtAddress.Text
End If
If txtCSZ.Text = "" Then
CSZ = InputBox("Please enter City, State, Zip!")
Else
CSZ = txtCSZ.Text
End If
End Sub
을 다음과 같이 코드입니다. 나는이 세 변수를 모두 문자열로 선언했고 프로그램을 실행했을 때 세 개의 텍스트 상자에 A B와 C를 입력했습니다.