Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting focus to a grid cell
Message
From
10/02/2009 15:44:48
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01379950
Message ID:
01380679
Views:
39
Glad you got it working Linda! =0)

~~Bonnie




>>Linda, is this a Web grid or a Windows grid? If you're talking about a Windows DataGridView, then probably all you need to do is set this property:
>>
>>this.EditMode = DataGridViewEditMode.EditOnEnter;
>>
>>~~Bonnie
>>
>>
>>
>>
>>>I have some very small tables in which users enter data directly. I am using buttons to add, delete, etc. When they click on the New button, I would like to put the cursor in the cell of the newly added row. I used grdMyGridControl.Focus(), which hightlights the correct cell but the user still has to click in the cell in order to start entering data. Any ideas? Thanks.
>
>Bonnie,
>It turns out that my original this.grdMyGrid.Focus() works just fine if you actually use the correct control name. It turns out I had a control reference remaining in the designer left from deleting a control from the form. I didn't notice that when I was setting the focus.
>In the process of figuring this out, I also came across another little tidbit. There is a form level function form.SetFocus(this.controlname). However, it does not work if the control is on a tab page. You may already know about this but perhaps it will help someone else. Thanks for your help.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform