itortu
asked on
ad rows to grid dynamically. not displaying the first row. URGENT PLEASE!
i need to know what i am doing wrong with the way i am adding rows to my grid.
the rows are being added, but the first row is been omitted, i think due to the way i set the header row.
So if i have serial number:
001
002
003
004
005
the grid only shows:
002
003
004
005
any help is greatly appreciated, thank you.
Const g_COL_SERIAL_NO = 0
If Not rstSelect Is Nothing Then
If Not rstSelect.BOF And Not rstSelect.EOF Then
Do While Not rstSelect.EOF
r = r + 1
grdSerialNumber.Rows = r + 1
For c = 0 To rstSelect.RecordCount - 1
strSerialNumber = rstSelect![serial_number]
grdSerialNumber.FormatStri ng = "Serial No"
grdSerialNumber.ColWidth(g _COL_SERIA L_NO) = 1335
grdSerialNumber.TextMatrix (totalRecs , 0) = strSerialNumber
Next c
rstSelect.MoveNext
totalRecs = totalRecs + 1
Loop
Else
' Do nothing
End If
End If
the rows are being added, but the first row is been omitted, i think due to the way i set the header row.
So if i have serial number:
001
002
003
004
005
the grid only shows:
002
003
004
005
any help is greatly appreciated, thank you.
Const g_COL_SERIAL_NO = 0
If Not rstSelect Is Nothing Then
If Not rstSelect.BOF And Not rstSelect.EOF Then
Do While Not rstSelect.EOF
r = r + 1
grdSerialNumber.Rows = r + 1
For c = 0 To rstSelect.RecordCount - 1
strSerialNumber = rstSelect![serial_number]
grdSerialNumber.FormatStri
grdSerialNumber.ColWidth(g
grdSerialNumber.TextMatrix
Next c
rstSelect.MoveNext
totalRecs = totalRecs + 1
Loop
Else
' Do nothing
End If
End If
ASKER
i am getting now a overflow error using your code snippet.
how can then the code be with the header row in it?
thank you.
how can then the code be with the header row in it?
thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i am still getting the overflow run time error '6'
ASKER
this how i got it to work.
Const g_COL_SERIAL_NO = 0
Dim r As Integer
grdSerialNumber.Rows = 1
grdSerialNumber.TextMatrix (r, 0) = "Serial No"
If Not rstSelect Is Nothing Then
If Not rstSelect.BOF And Not rstSelect.EOF Then
With grdSerialNumber
While Not rstSelect.EOF
r = r + 1
.Rows = .Rows + 1
.ColWidth(g_COL_SERIAL_NO) = 1335
.TextMatrix(r, g_COL_SERIAL_NO) = rstSelect![serial_number]
rstSelect.MoveNext
Wend
End With
Else
' Do nothing
End If
End If
Const g_COL_SERIAL_NO = 0
Dim r As Integer
grdSerialNumber.Rows = 1
grdSerialNumber.TextMatrix
If Not rstSelect Is Nothing Then
If Not rstSelect.BOF And Not rstSelect.EOF Then
With grdSerialNumber
While Not rstSelect.EOF
r = r + 1
.Rows = .Rows + 1
.ColWidth(g_COL_SERIAL_NO)
.TextMatrix(r, g_COL_SERIAL_NO) = rstSelect![serial_number]
rstSelect.MoveNext
Wend
End With
Else
' Do nothing
End If
End If
iTotalRows = 0
If Not rstSelect Is Nothing Then
If Not rstSelect.BOF And Not rstSelect.EOF Then
Do While Not rstSelect.EOF
iTotalRows = iTotalRows + 1
grdSerialNumber.Rows = iTotalRows
grdSerialNumber.TextMatrix
Loop
End If
End If