473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Datagrid cell focus

Hi all,
while editing a datagrid cell, if i press Enter key
focus goes to the next row, instead that i would like to
have focus on next cell, how can i obtain this.

Thanks & Regards,
Nanda
Nov 15 '05 #1
2 12976
Hey Nanda

this could help!!!!
You can override ProcessCmdKey, catch the Enter Key, and swap it for a
Tab key by sending a Tab, and not processing the Enter Key.

[C#]

public class MyDataGrid : DataGrid

{

protected override bool ProcessCmdKey(ref
System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)

{

if(msg.WParam.ToInt32() == (int) Keys.Enter)

{

SendKeys.Send("{Tab}");

return true;

}

return base.ProcessCmdKey(ref msg, keyData);

}

}

[VB.NET]

Public Class MyDataGrid

Inherits DataGrid

Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, keyData As System.Windows.Forms.Keys) As
Boolean

If msg.WParam.ToInt32() = CInt(Keys.Enter) Then

SendKeys.Send("{Tab}")

Return True

End If

Return MyBase.ProcessCmdKey(msg, keyData)

End Function 'ProcessCmdKey

End Class 'MyDataGrid

found on best Faq site!!!!

http://www.syncfusion.com/FAQ/WinForms/default.asp
Kind regards

SurfCoder

"Nanda" <cs******@hotmail.com> wrote in message
news:0b****************************@phx.gbl...
Hi all,
while editing a datagrid cell, if i press Enter key
focus goes to the next row, instead that i would like to
have focus on next cell, how can i obtain this.

Thanks & Regards,
Nanda

Nov 15 '05 #2
Hi,
Thanx for your reply. I hope it would help me.

Regds,
Nanda.
-----Original Message-----
Hey Nanda

this could help!!!!
You can override ProcessCmdKey, catch the Enter Key, and swap it for aTab key by sending a Tab, and not processing the Enter Key.
[C#]

public class MyDataGrid : DataGrid

{

protected override bool ProcessCmdKey(ref
System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{

if(msg.WParam.ToInt32() == (int) Keys.Enter)
{

SendKeys.Send("{Tab}");

return true;

}

return base.ProcessCmdKey(ref msg, keyData);
}

}

[VB.NET]

Public Class MyDataGrid

Inherits DataGrid

Protected Overrides Function ProcessCmdKey (ByRef msg AsSystem.Windows.Forms.Message, keyData As System.Windows.Forms.Keys) AsBoolean

If msg.WParam.ToInt32() = CInt (Keys.Enter) Then
SendKeys.Send("{Tab}")

Return True

End If

Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey

End Class 'MyDataGrid

found on best Faq site!!!!

http://www.syncfusion.com/FAQ/WinForms/default.asp
Kind regards

SurfCoder

"Nanda" <cs******@hotmail.com> wrote in message
news:0b****************************@phx.gbl...
Hi all,
while editing a datagrid cell, if i press Enter key
focus goes to the next row, instead that i would like to
have focus on next cell, how can i obtain this.

Thanks & Regards,
Nanda

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: raj | last post by:
Hi, The focus in the datagrid is not lost even after leaving the datagrid. The selected cell is highlighted even when the focus from the datagrid is lost. This happens only after the .NET...
1
by: Lester Moreno | last post by:
Hello all, I'm trying to find a way to get a event raised when you change some text on a DataGrid Cell, I need to be able to search in another table what the user typed on that cell. I found...
11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
5
by: Bryan Masephol | last post by:
Hi All I got a datagrid and a ComboBox on a form. I populate the combobox with years for all the data avaiable. When the user chooses a year the datagrid is populated with the specific years...
2
by: Bill C. | last post by:
Hi, I'm trying to implement a ComboBox drop-down column for a DataGrid. When a cell is selected in the ComboBox column I overlay a ComboBox over the cell and call: this.comboBox.Show();...
1
by: Gidi | last post by:
Hi All, i have a datagrid table that contains customers names, and a textbox which the user enters the customer name and the datagrid's dataset is updated so the customer name will be first....
0
by: Grant Smith | last post by:
I've been creating my own datagrid control which I'm inheiriting from the standard datagrid control and I have come across two very interesting behaviors with the datagrid control. 1. If you...
4
by: John Smith | last post by:
Hi All; I am using the HeaderAndDataAlignColumn class from Ken Tucker. I have customized it for a wider row. I reposition the DrawString method so the text is centered vertically in the row. ...
21
by: Sharon | last post by:
I have added an auto scroll feature to my DataGrid control like this: private void DoAutoScroll() { DataView dv = m_DataGrid.DataSource as DataView; DataGridCell cell = m_DataGrid.CurrentCell;...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.