Hi,
I'd like to catch the click on the header row, the first on the datagrid, but it doesn't seems to allow me doing that, first cause i can see the cursor on the data row's and it never leaves there.What i'm trying to achieve is:
Private Sub grid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grid.Click
if grid.row = 0
MsgBox(grid.Cols(grid.Col).Name)
end if
End Sub
No way that i can get this to work? What i want is to catch the column name of the header row where i have clicked.
Jorge,
Hello Jorge,
I was able to accomplish this in the BeforeSort event. I am attaching a sample that illustrates this. Please note, that this way will essentially disable column sorting. If this presents a problem or is not what you are looking for, please let me know. I hope this helps.
Regards,
-Raleigh
Hi there,
Thanks, it's ... almost this!
With this i can fill a variable with the columns names and then refill the grid by that order, i wanna to do it by:
1-Press CTRL2-Click the columns that i want to sort to3-Release CTRL, and hwre on release, refill the grid
But when i press CTRL, the sortcolumn event doesn't seem to fire, am i correct?
Place a breakpoint on the following line in the BeforeSort event:
e.Cancel = True;
When you run the program you will see that the event fires when pressing CTRL. I'm not exactly sure what you are trying do other than that, but it sounds as though you need to handle the C1FlexGrid's KeyUp and KeyDown events. I hope this helps.
Doesn't work, check this on the beforesort() event:
---
MsgBox("ai") e.Cancel = True
' some code
The msgbox() doesnt appear when i press CTRL and click on the grid's header.If you try to do this on the sample i sent me it doesn't work either.
I tried this again and I believe you are correct, the event does not fire. I am attaching a different sample for you to look at that is fairly different. This sample makes use of four events (KeyUp, KeyDown, BeforeSort, and MouseDown). I hope this helps.
Well, it's this what i want!
Im just going ask you one thing, i'm having some problems converting it to vb.net, could you post a sample in vb?
I'm glad I could help! Here is the sample in Visual Basic.