I can not seem to figure this out, please help. This program worked
perfectly in Visual Studio 2003. The program gets the information from an
Access Database. I am using OleDbSelectComm and to select certain records.
When I run the program and click Button1 the test works OK. The problem is
when I select another Button the correct records appear but the
QuestionCounter is not correct. It shows " Question 10 of 10 ". I think it
has something to do with the Count not releasing.
Here is a sample.
'This is for counting questions
Private Sub QuestionCounter ()
Dim Question, Current As Integer
Question = Me.BindingConte xt(DataSet1, "Table1").C ount
Current = Me.BindingConte xt(DataSet1, "Table1").Posit ion + 1
Label1.Text = "Question " & Current.ToStrin g & " of " &
Question.ToStri ng
End Sub
'This Button for Test 1
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 1 And 10)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
'This Button for Test 2
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 11 And 20)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
'This Button for Test 2
Private Sub Button3_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button3.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 21 And 30)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
Any help would be appreciated.
Thanks Perry Langla plangla@hotmail .com
perfectly in Visual Studio 2003. The program gets the information from an
Access Database. I am using OleDbSelectComm and to select certain records.
When I run the program and click Button1 the test works OK. The problem is
when I select another Button the correct records appear but the
QuestionCounter is not correct. It shows " Question 10 of 10 ". I think it
has something to do with the Count not releasing.
Here is a sample.
'This is for counting questions
Private Sub QuestionCounter ()
Dim Question, Current As Integer
Question = Me.BindingConte xt(DataSet1, "Table1").C ount
Current = Me.BindingConte xt(DataSet1, "Table1").Posit ion + 1
Label1.Text = "Question " & Current.ToStrin g & " of " &
Question.ToStri ng
End Sub
'This Button for Test 1
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 1 And 10)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
'This Button for Test 2
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 11 And 20)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
'This Button for Test 2
Private Sub Button3_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button3.Click
Me.OleDbSelectC ommand1.Command Text = "SELECT Table1.* FROM Table1
WHERE (ID Between 21 And 30)"
OleDbDataAdapte r1.Fill(DataSet 1)
QuestionCounter ()
End Sub
Any help would be appreciated.
Thanks Perry Langla plangla@hotmail .com
Comment