We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

activating row

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.gridControl1.Focus(); this.gridControl1.CurrentCell.MoveTo(1, 1, GridSetCurrentCellOptions.SetFocus | GridSetCurrentCellOptions.ScrollInView, false); } This combination doesn't seem to work. No row gets selected. Did I forget something here? regards, Dirk

4 Replies

AD Administrator Syncfusion Team March 11, 2003 05:31 PM UTC

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?

DP Dirk Puis March 12, 2003 06:29 AM UTC

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.

AD Administrator Syncfusion Team March 12, 2003 09:01 AM UTC

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 (available for download from your support home page).

DP Dirk Puis March 12, 2003 11:37 AM UTC

Yup, that did the trick. I was running Thanks

Live Chat Icon For mobile
Up arrow icon