How do I make a datagridview not selectable?

  • Thread starter Thread starter Bernard.Mangay
  • Start date Start date
After you have entered your data, you could set DataGridView1.Enabled = false;
 
After you have entered your data, you could set DataGridView1.Enabled =false;

Thanks. That works.

However, when enable=false, I can't scroll the datagrid anymore. Is
there a way to make it scrollable while not enabled?
 
That would be difficult with the DataGridView (dgv) control disabled. You'd
have to write your own code to capture the mouse wheel movements, then scroll
the dgv control on your own by making lower rows visible.

You are delving into 'non-trivial' code.

Here's another approach: Write code to handle the dgv's
SelectedIndexChanged, and whenever that is fired, call:

dgv.CurrentRow.Selected = false;

That should cover you.

Always more than one way to skin a cat (although I've never known anyone
morbid enough to skin cats).
 
Awesome! That worked. Thanks!


That would be difficult with the DataGridView (dgv) control disabled. You'd
have to write your own code to capture the mouse wheel movements, then scroll
the dgv control on your own by making lower rows visible.

You are delving into 'non-trivial' code.

Here's another approach: Write code to handle the dgv's
SelectedIndexChanged, and whenever that is fired, call:

dgv.CurrentRow.Selected = false;

That should cover you.

Always more than one way to skin a cat (although I've never known anyone
morbid enough to skin cats).







- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top