473,432 Members | 1,738 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,432 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 5231
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...
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
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
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...
1
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,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.