473,396 Members | 1,975 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,396 software developers and data experts.

SelectNextControl

VJ
I am in the last row of my datagrid and in the last but one column. I don't
want the user to tab to the last column, but to my save button. How do I
accomplish this?, using SelectNextControl does not work.. I even tried
base.Parent.SelectNextControl, its of no use.. I have the code below..

private void dataGrid1_CurrentCellChanged(object sender,
System.EventArgs e)
{

int rowChanging = dataGrid1.CurrentCell.RowNumber;
DataTable table = dataSet.Tables[0];
int intMaxRows = tSheet.Rows.Count - 1;

if (dataGrid1.CurrentCell.ColumnNumber == 7)
{
if (dataGrid1.CurrentCell.RowNumber >= intMaxRows - 1 )
{
//Select the next control in tab order i.e the btnSave

dataGrid1.SelectNextControl(btnSave,true,false,tru e,true);

//dataGrid1.SelectNextControl(btnSave,true,false,tru e,true); - this does not
work either..

//base.parent.SelectNextControl(btnSave,true,false,t rue,true); - this does
not work either..
return;
}
//setfoucs to next rows first cell.
dataGrid1.CurrentCell = new DataGridCell(rowChanging + 1,1);
}

}

on debugging the "SelectNextControl" gets hit exactly when the user tabs out
of the last but one cell of the lastrow.. but the foucs does not get set to
the next control..

VJ

Nov 16 '05 #1
1 5175
VJ
I am in the last row of my datagrid and in the last but one column. I don't
want the user to tab to the last column, but to my save button. How do I
accomplish this?, using SelectNextControl does not work.. I even tried
base.Parent.SelectNextControl, its of no use.. I have the code below..

private void dataGrid1_CurrentCellChanged(object
sender,System.EventArgs e)
{

int rowChanging = dataGrid1.CurrentCell.RowNumber;
DataTable table = dataSet.Tables[0];
int intMaxRows = table.Rows.Count - 1;

if (dataGrid1.CurrentCell.ColumnNumber == 7)
{
if (dataGrid1.CurrentCell.RowNumber >= intMaxRows - 1 )
{
//Select the next control in tab order i.e the btnSave

dataGrid1.SelectNextControl(btnSave,true,false,tru e,true);

//dataGrid1.SelectNextControl(btnSave,true,false,tru e,true); - this does not
work either..

//base.parent.SelectNextControl(btnSave,true,false,t rue,true); - this does
not work either..
return;
}
//setfoucs to next rows first cell.
dataGrid1.CurrentCell = new DataGridCell(rowChanging + 1,1);
}

}

on debugging the "SelectNextControl" gets hit exactly when the user tabs out
of the last but one cell of the lastrow.. but the foucs does not get set to
the next control..

VJ
Nov 16 '05 #2

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

Similar topics

6
by: Adrian | last post by:
I want to move to the next text box when enter is pressed. The text boxes are in tab order and start with 0. Could someone please correct the error line for me? Many thanks. private void...
1
by: Stan Sainte-Rose | last post by:
I still have a problem using the datagrid with my Class when I press the Tab Key. I add this condition If msg.wparam.ToInt32()=Cint(Keys.tab) Then MyBase.SelectNextControl(Me, True, True, True,...
7
by: Sueffel | last post by:
Okay, I have my controls, and in each one's key_down even, I have: Me.SelectNextControl(Me.ActiveControl,True,True,False,True) All controls I need do have the TabStops and do have Index's set. ...
7
by: Doug Bell | last post by:
Hi, I have just built a small application with a form that has one Text Box and one Check Box and a couple of Command Buttons. What I am trying to achieve is that if the Text Box has focus and...
20
by: Just Me | last post by:
Below is the result of the wizard conversion from VB6. Looking at the Help doc I can find an example that uses Chaw() If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then e.Handled = True End...
3
by: Mike L | last post by:
Custom text box to go to next text box in tab list. When the user types in a text box and the max length is meet, the focus goes to the next text box in the tab list. Here is my code so far, but...
2
by: Mike L | last post by:
I built 3 textbox classes. The auto tab does not tab to the next control in the tab list. No errors, and the code steps through "this.SelectNextControl(this, true, true, true, true);". What is...
2
by: Starbuck | last post by:
HI In a edit form which has text boxes is it possible to emulate TAB and Shift-TAB with the UP & DOWN keys Thanks in advance
1
by: Flack | last post by:
Hey guys, I'm having some weird issues when calling Dispose on one of the controls in a user control from an asycn or sync method. When called form an async method Dispose makes a call to...
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
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
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,...
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.