I made my own grid "control" with labels and a scroll bar. When the scroll bars are moved quickly, none of my sql statements are executed. They all return an error. The gird works when the scroll bars are moved slowly, the problem is only when they are moved quickly. Here is how I am reading the data:
Try
cmd = New SqlCeCommand(sql, SqlConn)
dr = cmd.ExecuteReader
Catch ex As Exception
MsgBox("Error in filling grid")
Exit Sub
End Try
It onlys shows that message box when the scroll bars are moved quickly. I also tried adding a timer like this:
Private Sub HScroll_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles HScroll.ValueChanged
Sec = 0
timDraw.Enabled = True
End Sub
Private Sub timDraw_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timDraw.Tick
Sec += 1
If Sec >= 3 Then
'stop timer
Sec = 0
timDraw.Enabled = False
'draw grid
FillGrid()
End If
End Sub
The interval of the timer is 30 ms. The grid consists of 5 rows and 3 columns. There isn't that much code in FillGrid but it gets called over and over very quickly. Any ideas? Thanks for the help.