I have the following code which fills a DataGrid and formats the columns so that if they contain 0, they display a space.
The code fails in the highlighted line but it only fails when the row it wants to work on is beyond the number of rows it can display.
If I make the DataGrid longer in the IDE so it can display more rows, it works perfectly.
I have tried dgGroup.FirstRow= 5
I have tried dgGroup.Scroll 0,1
Nothing seems to work.
Can somebody point me in the right direction please.
The code fails in the highlighted line but it only fails when the row it wants to work on is beyond the number of rows it can display.
If I make the DataGrid longer in the IDE so it can display more rows, it works perfectly.
I have tried dgGroup.FirstRow= 5
I have tried dgGroup.Scroll 0,1
Nothing seems to work.
Can somebody point me in the right direction please.
Code:
Private Sub FillDGrid()
Dim g As Integer
Dim f As Integer
Dim sSQL As String
sSQL = "SELECT grName AS [Group] , grHours AS [Length] ,grTimeMon AS Mon, grTimeTue AS Tue, grTimeWed AS Wed, "
sSQL = sSQL & " grTimeThu AS Thu, grTimeFri AS Fri, grTimeSat AS Sat, grTimeSun AS Sun "
sSQL = sSQL & " FROM tblGroup ORDER BY grName"
ShowData (sSQL)
dgGroup.Columns(0).Width = 1200
dgGroup.Columns(1).Width = 2550
For f = 2 To 8
dgGroup.Columns(f).Width = 550
dgGroup.Columns(f).NumberFormat = "h:mm"
Next f
dgGroup.Columns(1).NumberFormat = "hh:mm"
For f = 0 To RecSet.RecordCount - 1
dgGroup.Row = f
For g = 2 To 8
If dgGroup.Columns(g).Text = "0:00" Then
dgGroup.Columns(g).Text = ""
End If
Next g
Next f
End Sub