Hi,
I have a problem and I can't figure out whats wrong. I have a mshflexgrid connected to a ado control. The mshflexgrid displays the data in the database correctly.
I used this code to highlight a row when a user clicked on a row:
Private Sub MSHFlexGrid2_Click()
For i = 1 To MSHFlexGrid2.Rows - 1
MSHFlexGrid2.RowSel = i
MSHFlexGrid2.CellForeColor = vbBlack
MSHFlexGrid2.CellBackColor = vbWhite
Next
MSHFlexGrid2.RowSel = MSHFlexGrid2.Row
MSHFlexGrid2.FillStyle = flexFillRepeat
MSHFlexGrid2.CellBackColor = &HFFC0C0
End Sub
This works fine. The problem comes when I have run an sql query on the table to fetch records. If no records are found, no records appear in the MSHFlexGrid which is correct. However now when I run another sql query on the table and the records are found, they are displayed in the flexgrid, but the selected row is not higlighted when I click on a row. This only happens after I have run a query on the table that brings no results back.
I watched the varible (MSHFlexGrid2.Row) when the selected row does not highlight and this seems to be one more then it should be. I have no idea why. Can anyone gelp me out?
If you need more info please tell me,
Thanks,
Taha
I have a problem and I can't figure out whats wrong. I have a mshflexgrid connected to a ado control. The mshflexgrid displays the data in the database correctly.
I used this code to highlight a row when a user clicked on a row:
Private Sub MSHFlexGrid2_Click()
For i = 1 To MSHFlexGrid2.Rows - 1
MSHFlexGrid2.RowSel = i
MSHFlexGrid2.CellForeColor = vbBlack
MSHFlexGrid2.CellBackColor = vbWhite
Next
MSHFlexGrid2.RowSel = MSHFlexGrid2.Row
MSHFlexGrid2.FillStyle = flexFillRepeat
MSHFlexGrid2.CellBackColor = &HFFC0C0
End Sub
This works fine. The problem comes when I have run an sql query on the table to fetch records. If no records are found, no records appear in the MSHFlexGrid which is correct. However now when I run another sql query on the table and the records are found, they are displayed in the flexgrid, but the selected row is not higlighted when I click on a row. This only happens after I have run a query on the table that brings no results back.
I watched the varible (MSHFlexGrid2.Row) when the selected row does not highlight and this seems to be one more then it should be. I have no idea why. Can anyone gelp me out?
If you need more info please tell me,
Thanks,
Taha