I am using the code from the Grid KnowledgeBase 5.1 to make a gridcontrol behave like a listbox:
private void gridControl1_CurrentCellMoving(object sender, GridCurrentCellMovingEventArgs e)
e.ColIndex = 0;
private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
e.ColIndex = 0;
Now however, I want to combine this with some code to activate the first row of the grid in my form load event:
private void Form1_Load(object sender, System.EventArgs e)
This combination doesn't seem to work. No row gets selected. Did I forget something here?
ADAdministrator Syncfusion Team March 11, 2003 12:31 PM
I may be missing something, but I think I tried your code in a GridControl on a form, and it seemed to work as expected. Attached is the sample. Are you doing something different or expecting something other than the first row to be highlighted?
DPDirk PuisMarch 12, 2003 01:29 AM
Hmm, nope. The code is exactly the same and the effect as well. The only difference I see (since you are showing the rowheader and I am not) is that the first row does indeed become active. There is a slight pushed-down effect on the rowheader cell of the first row. But that effect is completely different from the effect you get when actually clicking in the first row (when the complete row becomes highlighted). That is the effect I'm trying to have on my form load. Attached is a jpeg that shows what I am seeing on screen.
ADAdministrator Syncfusion Team March 12, 2003 04:01 AM
When I run the sample, I see the right screen immediately (with the selected row) without doing any clicking.
What version of the grid are you using? I am using the 220.127.116.11 (available for download from your support home page).
DPDirk PuisMarch 12, 2003 06:37 AM
Yup, that did the trick. I was running 18.104.22.168.