P
Perry Langla
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 OleDbSelectCommand 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.BindingContext(DataSet1, "Table1").Count
Current = Me.BindingContext(DataSet1, "Table1").Position + 1
Label1.Text = "Question " & Current.ToString & " of " &
Question.ToString
End Sub
'This Button for Test 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 1 And 10)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
'This Button for Test 2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 11 And 20)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
'This Button for Test 2
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 21 And 30)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
Any help would be appreciated.
Thanks Perry Langla (e-mail address removed)
perfectly in Visual Studio 2003. The program gets the information from an
Access Database. I am using OleDbSelectCommand 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.BindingContext(DataSet1, "Table1").Count
Current = Me.BindingContext(DataSet1, "Table1").Position + 1
Label1.Text = "Question " & Current.ToString & " of " &
Question.ToString
End Sub
'This Button for Test 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 1 And 10)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
'This Button for Test 2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 11 And 20)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
'This Button for Test 2
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Table1.* FROM Table1
WHERE (ID Between 21 And 30)"
OleDbDataAdapter1.Fill(DataSet1)
QuestionCounter()
End Sub
Any help would be appreciated.
Thanks Perry Langla (e-mail address removed)