473,221 Members | 2,173 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,221 software developers and data experts.

How to set DataGridTextBox.TabStop ?

I have a DataGrid control with two columns.
I want to prevent the user getting into the first (left) column by the Tab
key, meaning; I need the cells of the left column to be set to TabStop =
fasle.

I found a small sample showing how to that
(http://msdn.microsoft.com/library/de...classtopic.asp)
So I tried:
DataGridTextBoxColumn textBoxColumn =
(DataGridTextBoxColumn)m_dataGrid.TableStyles[0].GridColumnStyles["LeftCloumnName"];
DataGridTextBox gridTextBox = (DataGridTextBox)textBoxColumn.TextBox;
gridTextBox.TabStop = false;

But still the tab gets there.

Can anybody show how can I do that?
-----
Thanks
Sharon
Dec 12 '05 #1
2 5213
Sharon,

The code you showed only prevents the control that is in the column from
getting focus, it won't prevent the column from being selected through tab.
I don't think that is possible with the current grid control.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:D5**********************************@microsof t.com...
I have a DataGrid control with two columns.
I want to prevent the user getting into the first (left) column by the Tab
key, meaning; I need the cells of the left column to be set to TabStop =
fasle.

I found a small sample showing how to that
(http://msdn.microsoft.com/library/de...classtopic.asp)
So I tried:
DataGridTextBoxColumn textBoxColumn =
(DataGridTextBoxColumn)m_dataGrid.TableStyles[0].GridColumnStyles["LeftCloumnName"];
DataGridTextBox gridTextBox = (DataGridTextBox)textBoxColumn.TextBox;
gridTextBox.TabStop = false;

But still the tab gets there.

Can anybody show how can I do that?
-----
Thanks
Sharon

Dec 12 '05 #2
Hi Sharon,

Thanks for your post.

To achieve what you want, I think we can do some customize to the code. My
thought is when the first column textbox got focus, just pass the focus to
the second column. Sample code like this:
private void Form1_Load(object sender, System.EventArgs e)
{
DataTable dt=new DataTable();
dt.TableName="test";
dt.Columns.Add(new DataColumn("column1", typeof(int)));
dt.Columns.Add(new DataColumn("column2", typeof(string)));
for(int i=0;i<5;i++)
{
DataRow dr=dt.NewRow();
dr["column1"]=i;
dr["column2"]="item"+ i.ToString();
dt.Rows.Add(dr);
}
this.dataGridTextBoxColumn1.TextBox.Enter+=new EventHandler(TextBox_Enter);
this.dataGrid1.DataSource=dt;
}

private void TextBox_Enter(object sender, EventArgs e)
{
this.dataGrid1.CurrentCell=
new DataGridCell(this.dataGrid1.CurrentCell.RowNumber,
this.dataGrid1.CurrentCell.ColumnNumber+1);
}

This works well on my side. Hope it helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Dec 13 '05 #3

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

Similar topics

0
by: Shravan | last post by:
Hi All, I wrote my own columnstyle for hosting textbox in which I used the textbox which is a extended version of DataGridTextBox, everything is OK except that in textbox in OnKeyPress method...
0
by: Jim Witt | last post by:
Ref: Win2000, .NET 1.1 I have a form: each line has textbox as input, ident label on left. For format purposes, each textbox is contained in a panel. Some labels are links (though not...
5
by: John Baro | last post by:
Where is my TabStop property. I want to prevent tabbing to a label. In the MSDN it shows Label.TabStop Property This member supports the .NET Framework infrastructure and is not intended to be...
2
by: Bob Cummings | last post by:
Greetings I have a simple form from which I would like the user to make one of two choices, depending on what I am displaying in a text box. I want the use to have to make a choice so I have...
1
by: Nikhil Patel | last post by:
Hi all, I need to allow users to copy the value of a TextBox but I don't want to allow them to edit the value. I am able to achieve this by setting the ReadOnly property to true. But now when the...
2
by: Rolf Falnes | last post by:
Hi. Does anyone know how to trigger the doubleclick mouse event in a datagrid cell (DatagridTextbox )? Regards, Rolf Falnes Datapartner AS
0
by: David-L. Nadeau | last post by:
Hi ! I have Windows form with a TabControl (3 TabPages). I set the TabStop and TabIndex property to all the textboxes in the 3 TabPages. In the first page, the functionality works fine but not...
1
by: Jon | last post by:
Hi, I can set the button.tabstop = false. but how do i clear the tabstop after the button has been clicked? the tabstop remains when the button has been clicked. thanks.
0
by: Rich | last post by:
Hello, I have a form that contains some textboxes and a couple of groupboxes that contain some radiobuttons. I have set the tabstop to false for all the radiobuttions. When the form originally...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.