473,830 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I make a datagridview not selectable?

I dont' want users to be able to select/highlight cells.
Aug 5 '08 #1
4 19405
After you have entered your data, you could set DataGridView1.E nabled = 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...@discus sions.microsoft .comwrote:
After you have entered your data, you could set DataGridView1.E nabled =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
SelectedIndexCh anged, 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...@discus sions.microsoft .comwrote:
After you have entered your data, you could set DataGridView1.E nabled = 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...@discus sions.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
SelectedIndexCh anged, 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...@discus sions.microsoft .comwrote:
After you have entered your data, you could set DataGridView1.E nabled= 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
3333
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... Otherwise, anyone know of a cheap 3rd party calendar control I could use that would provide that ability? Thanks, Rachel
5
5053
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 CurrentUICulture to what's specified in the querystring. Since I want to allow UICulture auto detecting, I add UICulture = "auto" to page directive on each page.
7
12641
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 the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
7
15667
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
1
2775
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 item. If I do not set the verticalpadding property, the items are rendered too close to one another. However, when I set the verticalpadding property, I get the spacing that I want but the selectable area within each item is the exact height of...
0
2507
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 my.
1
1882
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
5756
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 few celltemplate property getters and combobox/datecombo constructor calls without database access which does not take a lot of time. Debug output (below) shows lot of messages Stepping over non-user code. Running in release mode from...
2
3260
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 this.SetStyle(ControlStyles.Selectable, true); And it works fine when I use TAB key, but when I click on my object, the focus remains on the current object. What am I doing wrong?
0
9777
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9635
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10763
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10196
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6939
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5772
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4407
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.