473,698 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting a new cell in a DataGridView

Dom
I posted this before, no takers. Trying again.

Is there anyway to cancel the selection of a new cell in a
DataGridView? For example, if the user selects a cell with the
control key down, then I don't want the selection to change.

Dom
Feb 14 '08 #1
2 1468
Dom
Well, I decided to answer this question myself, since none of you
lunkheads seems to know how to do this.

I created MyDataGridView, which extends DataGridView and overrides the
OnMouseDown event handler. This new handler fires off two events,
MouseDownPrep and base.OnMouseDow n, but the second event only fires if
the result of the first event okays it.

I guess that's the only way.

Dom

On Feb 14, 9:59*am, Dom <dolivas...@gma il.comwrote:
I posted this before, no takers. *Trying again.

Is there anyway to cancel the selection of a new cell in a
DataGridView? *For example, if the user selects a cell with the
control key down, then I don't want the selection to change.

Dom
Feb 17 '08 #2
There's nothing that makes people here want to help you more than being
insulted.

RobinS.
---------------------------------------------
"Dom" <do********@gma il.comwrote in message
news:de******** *************** ***********@q78 g2000hsh.google groups.com...
Well, I decided to answer this question myself, since none of you
lunkheads seems to know how to do this.

I created MyDataGridView, which extends DataGridView and overrides the
OnMouseDown event handler. This new handler fires off two events,
MouseDownPrep and base.OnMouseDow n, but the second event only fires if
the result of the first event okays it.

I guess that's the only way.

Dom

On Feb 14, 9:59 am, Dom <dolivas...@gma il.comwrote:
I posted this before, no takers. Trying again.

Is there anyway to cancel the selection of a new cell in a
DataGridView? For example, if the user selects a cell with the
control key down, then I don't want the selection to change.

Dom
Feb 18 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14573
by: Rich | last post by:
Hello, If I want to update data displayed in a datagrideview/datagridview cell, how can I determine what cell I am updating? I am looking at the click event below, for example. Can I get information from the sender object or the EventArgs? How? Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click Console.WriteLine("row number of cell is ?")
2
15161
by: Bob | last post by:
How do I show a calendar control or another appropriate control to pick a date and time for a cell in a column in a datagridview? Thanks for any help. Bob
10
45204
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting event..., to no avail Any ideas Regards
2
1489
by: galletg | last post by:
please; how to write by code in a datagrid view cell a text in a textbox. thank you for your help. georges gallet
1
1924
by: Dranizz | last post by:
I want to set the value of a cell in a datagridview. DatagridView.CurrentRow.Cells(CEllName).value = "Blabla" When I do this in code and when it's the first cell I edit in a new row, it does not Bind to a new datarow. DatagridView.CurrentRow.DataBoundItem is nothing A new row is added only if I type (keyboard) anything in the cell, but programmatically, it does not add the row. How can I tell the datagridview, in code, that it must...
0
2156
by: =?Utf-8?B?UmljaA==?= | last post by:
In a datagridview, the first column header cell is columnHeader(0), which is immediately to the right of the Top Left Corner Select All cell. And the first RowHeader cell is RowHeaderCell(0) which is immediately below the Top Left Corner Select All cell. When clicking on the Top Left Corner SelectAll cell, which selects all the Rows/columns in the datagridview, the only event that appears to fire is the SelectionChanged event. But that...
1
13727
by: zacks | last post by:
Using VS 2005. I have an app that has a DataGridView control. This control has two columns, the first column is a standard TextBox, and the second column is a CheckBox. I am having difficulty determining the state of the CheckBox, whether it is checked or not. I have identified an event that fires when the user clicks in the checkbox, CellClick. In that event handler I declare a local variable of the DataGridViewCheckBoxCell type and...
12
13606
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid display in a textbox below the datgridview. I currently have it fixed so if you click on a row the note field from that row is put in the textbox. I'd like this to be automatic as they move through rows. Also the note field is one of two fields...
1
16988
by: Andrus | last post by:
I have Text box controls and DataGridView control in WinForms form. DataGridview contains custom ComboBox columns and standard TextBox columns. Edit mode is EditOnEnter. When focus is moved out of DataGridView, its current cell is displayed as selected state (blue background). How to remove this highlight so that selected cell is not highlighted at all (or highlighted only when grid is active control).
0
8676
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...
1
8898
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
7734
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
5860
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
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
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
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.