Tracking Tab Key Press in DataGridView
-
How can I track the keypress of Tab Key in a DataGridView. The column in which I want to track is of a textbox type column. Your suggestions will help me a lot. CSS.
Sekhar :)
What do you mean by "tracking a TextBox column"?? What do you want to do when the user hits the Tab key??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
What do you mean by "tracking a TextBox column"?? What do you want to do when the user hits the Tab key??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007use keydown or keyup event and check e.keydata = keys.tab :)
Salman Sheikh
-
What do you mean by "tracking a TextBox column"?? What do you want to do when the user hits the Tab key??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I have a TabControl and several pages to it. Each of the pages contains one datagridview and few buttons. I want when i press the tab key on the last cell of the last row of a datagridview, it should take me to the next page of the Tabcontrol and place the focus on the first cell of the datagridview of that page. So for this I need to track the keypress for the cell from which i want to shift the focus to the next page's datagridview. And the last column of the datagridview is a textBox type column.
Sekhar :)
-
I have a TabControl and several pages to it. Each of the pages contains one datagridview and few buttons. I want when i press the tab key on the last cell of the last row of a datagridview, it should take me to the next page of the Tabcontrol and place the focus on the first cell of the datagridview of that page. So for this I need to track the keypress for the cell from which i want to shift the focus to the next page's datagridview. And the last column of the datagridview is a textBox type column.
Sekhar :)
In that case, you handle the KeyDown event of the DGV and check the event args KeyCode property for the Keys.Tab key. If pressed, you have to check to see what the cuurnet cell is. If the current cell is the last one, you set the Handled propery of the event args to True and make your changes to the TabControl. Otherise, you do nothing.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007