S
Simon Verona
I don't know if anybody has any experience with using the TrueDBGrid from Component One (I believe that it's included in some of the Microsoft CD's as an additional component, but I've got the full registered component).
I use the truedbgrid in an inherited control with some additional functionality (mainly some custom data-binding code). I have added some code in the Double-Click event handler to raise another event that is picked up on my main form.
The double-click handler code is as follows:
Private Sub DmsReport_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.DoubleClick
' Raise Event for RowSelected
RaiseEvent RowSelected(sender.row)
End Sub
I expect sender.row to return the row number within the data that has been clicked so I can pick up the data using code such as dmsreport1.item(row,1) where row is the parameter from the raiseevent code above.
This works perfectly when I don't use the "grouping" feature of TrueDBGrid.
However, when I use grouping, and the user manually groups a column which causes rows to be hidden below expandable groups, I find that the row no returned is actually the row no that you clicked, but counting the Visible rows only, and adding one for each "group"... eg if there are 5 collapsed groups, and the sixth is "expanded" and I then click on the 2nd row of the expanded group, the row number returned is actually 7!!! However, using this row no to pick up the data using the item method (as above) counts the hidden rows as well so I don't return the data I expect!!!
Have I got my logic wrong? Is this a bug? Does anybody know a workaround??
I have posted this question both to ComponentOne and to their newsgroup without success, and hope somebody here has some thoughts on this component.
Apologies also if I've posted this to groups that aren't appropriate!
Many thanks in advance
Simon
I use the truedbgrid in an inherited control with some additional functionality (mainly some custom data-binding code). I have added some code in the Double-Click event handler to raise another event that is picked up on my main form.
The double-click handler code is as follows:
Private Sub DmsReport_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.DoubleClick
' Raise Event for RowSelected
RaiseEvent RowSelected(sender.row)
End Sub
I expect sender.row to return the row number within the data that has been clicked so I can pick up the data using code such as dmsreport1.item(row,1) where row is the parameter from the raiseevent code above.
This works perfectly when I don't use the "grouping" feature of TrueDBGrid.
However, when I use grouping, and the user manually groups a column which causes rows to be hidden below expandable groups, I find that the row no returned is actually the row no that you clicked, but counting the Visible rows only, and adding one for each "group"... eg if there are 5 collapsed groups, and the sixth is "expanded" and I then click on the 2nd row of the expanded group, the row number returned is actually 7!!! However, using this row no to pick up the data using the item method (as above) counts the hidden rows as well so I don't return the data I expect!!!
Have I got my logic wrong? Is this a bug? Does anybody know a workaround??
I have posted this question both to ComponentOne and to their newsgroup without success, and hope somebody here has some thoughts on this component.
Apologies also if I've posted this to groups that aren't appropriate!
Many thanks in advance
Simon