名前を入力したときに残高を表示するループを作成しましたが、もう一度実行しようとすると。別の出力 (メッセージボックス) を返しません。ループを終了/再開するにはどうすればよいですか?
Public Class Form1
Dim intMax_Subscript As Integer = 7
Dim arrayNames(intMax_Subscript) As String
Dim arrayBalance(intMax_Subscript) As Double
Dim found As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CBO1.Items.Add("John One")
arrayNames(0) = CStr(CBO1.Items(0))
CBO1.Items.Add("Jack Two")
arrayNames(1) = CStr(CBO1.Items(1))
CBO1.Items.Add("John Three")
arrayNames(2) = CStr(CBO1.Items(2))
CBO1.Items.Add("Jack Four")
arrayNames(3) = CStr(CBO1.Items(3))
CBO1.Items.Add("John Five")
arrayNames(4) = CStr(CBO1.Items(4))
CBO1.Items.Add("Jack Six")
arrayNames(5) = CStr(CBO1.Items(5))
CBO1.Items.Add("John Seven")
arrayNames(6) = CStr(CBO1.Items(6))
CBO1.Items.Add("Jack Eight")
arrayNames(7) = CStr(CBO1.Items(7))
CBO2.Items.Add("235.50")
arrayBalance(0) = CDbl(CBO2.Items(0))
CBO2.Items.Add("78943.98")
arrayBalance(1) = CDbl(CBO2.Items(1))
CBO2.Items.Add("230781.10")
arrayBalance(2) = CDbl(CBO2.Items(2))
CBO2.Items.Add("78362.00")
arrayBalance(3) = CDbl(CBO2.Items(3))
CBO2.Items.Add("12097.20")
arrayBalance(4) = CDbl(CBO2.Items(4))
CBO2.Items.Add("89267.34")
arrayBalance(5) = CDbl(CBO2.Items(5))
CBO2.Items.Add("34959.06")
arrayBalance(6) = CDbl(CBO2.Items(6))
CBO2.Items.Add("559284.50")
arrayBalance(7) = CDbl(CBO2.Items(7))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBalance.Click
Dim input As String = InputBox("Input a name")
Dim intcount As Integer = -1
Dim intSubscript As Integer = 0
Do While Not found And intcount < arrayNames.Length
If arrayNames(intSubscript) = input Then
found = True
MessageBox.Show("The balance of " & input & "'s is " & arrayBalance(intSubscript))
intSubscript = 0
intcount = -1
End If
intSubscript += 1
Loop
If Not arrayNames.Contains(input) Then
MessageBox.Show("Error: Name not found.")
End If
End Sub