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

How to disable changing contents of a column within a DataGridView

Rob
I have a few columns wich represent a primary key from a table. I would
like to disallow changing any of its content within the datagridview.

Something that would appear logical to me does not work (to disable changing
the first column)....

DataGridView1.Columns(0).ReadOnly.ToString - does not work

DataGridView1.Columns(0).Enabled = False - no such command

Any ideas ?
Jun 27 '08 #1
2 4654
DataGridView1.Columns(0).ReadOnly = True

On Jun 24, 7:58 am, "Rob" <ro...@yahoo.comwrote:
I have a few columns wich represent a primary key from a table. I would
like to disallow changing any of its content within the datagridview.

Something that would appear logical to me does not work (to disable changing
the first column)....

DataGridView1.Columns(0).ReadOnly.ToString - does not work

DataGridView1.Columns(0).Enabled = False - no such command

Any ideas ?
Jun 27 '08 #2
Rob
Thanks.... I should have known...

"Bill Schanks" <ws******@gmail.comwrote in message
news:20**********************************@a1g2000h sb.googlegroups.com...
DataGridView1.Columns(0).ReadOnly = True

On Jun 24, 7:58 am, "Rob" <ro...@yahoo.comwrote:
>I have a few columns wich represent a primary key from a table. I would
like to disallow changing any of its content within the datagridview.

Something that would appear logical to me does not work (to disable
changing
the first column)....

DataGridView1.Columns(0).ReadOnly.ToString - does not work

DataGridView1.Columns(0).Enabled = False - no such command

Any ideas ?

Jun 27 '08 #3

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

Similar topics

1
by: Rithish Saralaya | last post by:
I have a column in a table as follows, <TD ID='COL_ID_1'> Test Text <IMG ID='IMG_ID_1' SRC='http://myServer.com/images/myImg.gif' onClick=\"alert ( 'clicked' )\"></TD> I want to disable the...
0
by: Bob | last post by:
I have a combox column in a datagridview (vs2005 and VB.NET). Once I select an item from the dropdownlist in the combox and do a save, I can no longer remove the item. I can change my selection but...
0
by: Bob | last post by:
I attached the properties list of the column in a datagridview. The datagridview is bound. Note that the cell visible property is set to false and while looking at the datagridview in the VS IDE...
0
by: martin1 | last post by:
All, how to disable DatagridView column sort? Thanks
3
by: Mike | last post by:
Dear group, I'm currrently investigating a bug within a piece of our software whereby if a DataGridView (bound directly to a DataTable) is ordered by column headers (containing lookup combo...
1
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
0
by: sixths3ns3 | last post by:
My DataGridView has two columns. Combobox Column 2 displays list based on Combobox Column 1 selected value. The code below works fine when I select a value on Column 1, and select a value on Column...
0
by: Hassan | last post by:
Hi, Im using visual studio 2005,C#2 Framework 2.0 In my program, i have a DataGridView where DataGridView.DataSource equal to a BindingSource.DataSource and this BindingSource.DataSource equalt...
3
by: Bruno Neves Pires Silva | last post by:
Hello, Programmers. How can I disable sorting in a DatagridView? Thanks in advance.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.