472,958 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 19265
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rachel Suddeth | last post by:
Is there a way to have the non-selectable dates (those before MinDate and after MaxDate) draw differently so my users can see right away what dates aren't allowed? I'm not seeing it... ...
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: Homer | last post by:
Hi, I used a template for my first Web application. I made a few changes to the layer thru its css file. The problem that has been vexing me is the vertical spacing for each navigation menu...
0
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by...
1
by: dbphoto | last post by:
I've created a selectable layer and inputted the action script into the button but the layer appears on the main layer and is not selectable. Any ideas?
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
2
by: DMVC | last post by:
Hi all. I've built a class based on "Control" and I want this object of mine to be selectable. I believe that, by default, Control is non-selectable so I used ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.