473,422 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,422 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 19345
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.