forループの使用に関する質問があります。検索はので、いくつかのがMSGBOXForループでカウンタを使用する
はそうどこtrytimeループを置くことを表示する3回見つからない場合、以下のデータベース・フィルタリングのためのコードは、Visual Basic 2008
Private Sub txtsearch_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtsearch.KeyDown
On Error Resume Next
If e.KeyCode = Keys.Enter Then
'' Me.Table1BindingSource.Filter = "EmpID = ' " & Me.txtsearch.Text & "'"
On Error Resume Next
Dim temp As Integer = 0
Dim trytime As Integer = 0
Me.Table1BindingSource.Filter = "EmpID = ' " & Me.txtsearch.Text & "'"
For i As Integer = 0 To Table1DataGridView.RowCount - 1
For j As Integer = 0 To Table1DataGridView.ColumnCount - 1
If Table1DataGridView.Rows(i).Cells(j).Value.ToString = txtsearch.Text Then
''if item found then we play sound ok
My.Computer.Audio.Play("F:\beep.wav", AudioPlayMode.WaitToComplete)
My.Computer.Audio.Play("F:\beep.wav", AudioPlayMode.WaitToComplete)
temp = 1
End If
Next
Next
If temp = 0 Then
''if item not found then we play sound err
My.Computer.Audio.Play("F:\computer_access.wav", AudioPlayMode.WaitToComplete)
Me.Table1TableAdapter.Fill(Me.MydbDataSet.Table1)
Me.Table1DataGridView.Refresh()
txtsearch.Text = ""
End If
End If
End Sub
私の問題をされて使用されますか?
を?この手順は3回呼び出され、メッセージを表示しますか?変数スコープが間違って定義されている場合この手順の外にある必要があります。この手順から値を増やす必要があります。 – Spidey
ユーザーがMSGBOX **その後、間違った番号を入力するための3つの時間をしようとした場合、私は意味**は、彼が持っていた3回を試してみてください,,とcarful –