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

How to tell a DataGrid to use a customized DataGridTextBoxColumn

I am writing a customized DataGrid control which will allow the user to only
select an entire row (and not a cell inside the row). So I want to add
readonly columns to the datagrid. To achieve this, instead of using a
"DataGridTextBoxColumn" inside the datagrid I want the control to use a
"DataGridTextBoxColumn" that has a disabled "Edit" method. Therefor I have
created my own version of a "DataGridTextBoxColumn" class called
"ReadOnlyDataGridTextBox".

How do I get the DataGrid to use my "ReadOnlyDataGridTextBox instead of the
default "DataGridTextBoxColumn"?
Nov 15 '05 #1
1 1894

Użytkownik "Jaco Karsten" <ja*********@worldonline.co.za> napisał w
wiadomo¶ci news:#m**************@tk2msftngp13.phx.gbl...
I am writing a customized DataGrid control which will allow the user to only select an entire row (and not a cell inside the row). So I want to add
readonly columns to the datagrid. To achieve this, instead of using a
"DataGridTextBoxColumn" inside the datagrid I want the control to use a
"DataGridTextBoxColumn" that has a disabled "Edit" method. Therefor I have
created my own version of a "DataGridTextBoxColumn" class called
"ReadOnlyDataGridTextBox".

How do I get the DataGrid to use my "ReadOnlyDataGridTextBox instead of the default "DataGridTextBoxColumn"?

dataGrid1.TableStyles.Add(new DataGridTableStyle());
dataGrid1.TableStyles[0].MappingName = "Table1";
ReadOnlyDataGridTextBox style = new ReadOnlyDataGridTextBox();
style.MappingName = "Kol1";
dataGrid1.TableStyles[0].GridColumnStyles.Clear();
dataGrid1.TableStyles[0].GridColumnStyles.Add(style);
I hope it helps.

Gawel
Nov 15 '05 #2

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

Similar topics

3
by: Job Lot | last post by:
I am trying to implement searchable DataGrid. I am creating a DataSet object with DataRelation on form load, as follows: Private Sub BindDataGrid() Dim planTS As New DataGridTableStyle Dim appTS...
0
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the...
0
by: Jaco Karsten | last post by:
I am writing a customized DataGrid control which will allow the user to only select an entire row (and not a cell inside the row). So I want to add readonly columns to the datagrid. To achieve...
3
by: Peter | last post by:
I have a datagrid on WinForm and I am trying to format the Grid. I am using the following code, the code runs fine, but nothing happens after it runs, the datagrid does not change (with data in the...
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
17
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5...
6
by: Bill nguyen | last post by:
I use DatagridTableStyle to display data from table WF_Carrier_FreightChart. USers than can add/delete/edit rows in the Datagrid. Since the Datagrid's datasource "dCarrierFreight" is just a...
2
by: Sharon | last post by:
I want put into my DataGrid different control types in the same column. For example: Column 1, row 0 ==> TextBox Column 1, row 2 ==> CheckBox Column 1, row 2 ==> ComboBox etc... As I see, I...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.