I want to display a table from a database in Windows Forms. I want to make it read-only, so one can't create new rows or modify cells. How can that be achieved?
CodePudding user response:
A DataGridView has a ReadOnly property that you can set to true
. This will make automatically turn off the ability to add rows as well as prevent editing of cell contents. To have a DGV that is modify-only you can set AllowUserToAddRows to false
CodePudding user response:
Like this
dataGridView1.ReadOnly = True