473,406 Members | 2,387 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,406 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 12977
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.