HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Programming Tutorial 37<br />
Option Explicit On<br />
Option Strict On<br />
Public Class MainForm<br />
Private Sub exitButton_Click(ByVal sender As Object, _<br />
ByVal e As System.EventArgs) Handles exitButton.Click<br />
Me.Close()<br />
End Sub<br />
Appendix H C5779 39147 Page 37 07/10/06--JHR<br />
Private Sub MainForm_Load(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles MyBase.Load<br />
'TODO: This line of code loads data into the<br />
'TriviaDataSet.Game1' table. You can move,<br />
'or remove, it as needed.<br />
Me.Game1TableAdapter.Fill(Me.TriviaDataSet.Game1)<br />
End Sub<br />
Private Sub submitButton_Click(ByVal sender As Object, _<br />
ByVal e As System.EventArgs) Handles submitButton.Click<br />
' determines whether the user's answer is correct<br />
' keeps track of the number of incorrect answers<br />
' displays the next record or the number of<br />
' incorrect answers<br />
Dim recPtrPos As Integer<br />
Dim userAnswer As String = “”<br />
Static numIncorrect As Integer<br />
' store position of record pointer<br />
recPtrPos = Game1BindingSource.Position<br />
' determine selected radio button, which<br />
' represents the user’s answer<br />
Select Case True<br />
Case aRadioButton.Checked<br />
userAnswer = aRadioButton.Text.Replace(“&”, “”)<br />
Case bRadioButton.Checked<br />
userAnswer = bRadioButton.Text.Replace(“&”, “”)<br />
Case cRadioButton.Checked<br />
userAnswer = cRadioButton.Text.Replace(“&”, “”)<br />
Case dRadioButton.Checked<br />
userAnswer = dRadioButton.Text.Replace(“&”, “”)<br />
End Select<br />
' if necessary, update number of incorrect answers<br />
If userAnswer _<br />
TriviaDataSet.Game1(recPtrPos).CorrectAnswer Then<br />
numIncorrect = numIncorrect + 1<br />
End If<br />
(Figure is continued on next page)