hi there,

does anyone know how to make one column in the datagrid view to become readonly,

thanxxxxxx

Recommended Answers

All 3 Replies

You can set it in the designer by rightclicking the datagridview and Selecting Edit Columns. Then select the column you want and on the right you can alter its read-only property.
In code you can use dataGridView1.Columns["ColumnName"].ReadOnly = true;

the paremter specified accepts only type int, if i try to pass it a string compiler complains

if you mean here: << .Columns["ColumnName"] >> you can pass it a column number like this: <<.Columns[0]>>, with 0 being the first column in the DGV

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.