471,344 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

How do I make a datagridview not selectable?

I dont' want users to be able to select/highlight cells.
Aug 5 '08 #1
4 19047
After you have entered your data, you could set DataGridView1.Enabled = false;

"Bernard.Mangay" wrote:
I dont' want users to be able to select/highlight cells.
Aug 5 '08 #2
On Aug 5, 2:19*pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
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?
Aug 6 '08 #3
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).

"Bernard.Mangay" wrote:
On Aug 5, 2:19 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
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?
Aug 6 '08 #4
Awesome! That worked. Thanks!
On Aug 6, 2:10*pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
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).

"Bernard.Mangay" wrote:
On Aug 5, 2:19 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
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?- Hide quoted text -

- Show quoted text -
Aug 6 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rachel Suddeth | last post: by
7 posts views Thread by Mitchell S. Honnert | last post: by
7 posts views Thread by =?Utf-8?B?TG9zdEluTUQ=?= | last post: by
reply views Thread by jeastman - Hotmail | last post: by
1 post views Thread by dbphoto | last post: by
3 posts views Thread by Andrus | last post: by
reply views Thread by Ronak mishra | last post: by

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.