Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

VB.net DatagridView readonly property

$
0
0

HI,

At runtime, I create a datagridview control. I set its specific properties and then bind data to it from a datatable.

For example:

Dim Table As New DataGridView

Table.Name = "Table1"

Table.Readonly = true

Table....... etc.

As above, I set the property of the datagridview 'readonly' to 'true'. Later in code, I have created a sub that is called when the datagridview is double clicked. The sub gets the selected cell, and is supposed to 'unlock it'. I.e. set the particular cell's 'read only' property to 'false'.

In the later sub, I also set the selected cell's backcolor to green. 

My problem is that when I run the program, and double click the cell, the backcolor changes, but it isn't editable. I can see that I have the cell reference correct (because the backcolor changes).

My question is: After setting the Table.readonly = false, can I override the cell's readonly property later? 

If I go back and remove the "table.readonly = true", then the entire table is editable. I don't want the entire table to be editable, as i want the user to edit data only when the cell is double clicked (and the cell is checked to be appropriate for editing).

Thanks in advance for your help.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>