473,804 Members | 3,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process Event Delete with Mouse in DataGridView control

1 New Member
I have a event to Cancel Delete of user :

Expand|Select|Wrap|Line Numbers
  1. private void dataGridViewKV_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
  2.         {    
  3.             string maKV = e.Row.Cells[0].FormattedValue.ToString();
  4.             string tenKV = e.Row.Cells[1].FormattedValue.ToString();
  5.             string message = string.Format(
  6.                "Are you sure want to delete {0} [{1}]?",
  7.                tenKV,
  8.                maKV);
  9.             DialogResult result = MessageBox.Show(message, "Delete?", MessageBoxButtons.OKCancel);
  10.             if (result == DialogResult.Cancel)
  11.             {
  12.                 e.Cancel = true;
  13.                 MessageBox.Show("Cancelled Delete");
  14.             }
  15.         }
I added a contextmenustri p into DataGridView... When row header clicked by rightmouse, contextmenu is displayed!
Now, I want then choose Delete from ContextMenu, then dataGridViewKV_ UserDeletingRow () is called, or how to delete a row?

Expand|Select|Wrap|Line Numbers
  1. private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
  2.         {        
  3.           //  call method?
  4.         }
let me know...Thanks a lot!
Dec 10 '07 #1
0 1181

Sign in to post your reply or Sign up for a free account.

Similar topics

2
22023
by: Pete | last post by:
I have some funky form/event behavior. Access 97. Split frontend/backend, using Access security. I have the same behavior (or lack of behavior) for the pag_Click() event of two separate pages on different menu forms. Details: frmTRNMenu is the main menu of the application. It uses tabbed pages to logically separate menu items. The last tab on the list is different - it has an image and then "O&M". Clicking on this last page will...
1
1479
by: Tyson Ackland | last post by:
Is it possible, while dealing with an event, to ignore/delete any other event that might come along while I'm busy? My scenario is a mouse click on a picturebox control. I perform an action on the control in response to the click but I find that if the user clicks madly away, all preceeding clicks are subsequently actioned as the user sits back and watches. What I'd prefer to happen is all mouse clicks to be ignored while I'm actioning...
1
2001
by: Andy | last post by:
Hi all, I'm a beginner. I have a problem. In my datagrid i have read only data grid. I written code to delete a row by using delete key in keydown event of datagrid. But this event is not always firing. I have to select index using mouse and when i press delete key the arrow icon change into a pen. And then i have to click the same row with the mouse and then press delete key. Now it's works. Why? I want to delete arow using click mouse...
4
4867
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a sql DataAdapter (da) da.SelectCommand.CommandText = "Select * from Servertbl1" da.Fill(ds, "tbl1") so far, so good. If I add a row to the datagridview I use the following sqlDataAdapter code to update the server table - which works OK when...
4
3818
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've a MouseEnter event on a dataGrid, and I want to know, if the mouse entered column no. 0 or column no. 1 . How can it be done? Thanks, Gidi.
0
11360
MMcCarthy
by: MMcCarthy | last post by:
VBA is described as an Event driven programming language. What is meant by this? Access, like most Windows programs, is an event driven application. This means that nothing happens unless it is in response to some event that has been detected by the application. The steps are fairly straightforward: An event happens The event is detected by the application The application responds to the eventThe Windows OS will automatically detect...
0
1594
by: Przemek | last post by:
Hello, I have a little problem. I use flat style for Buttons on DataGridView and every looks fine (non 3d buttons) but when I move mouse over DataGridView Button then background of this button are darker and when I down left button of my mouse over this DataGridView Button then background of this button are lighter. I want to see one color (ex. "Control") when I move over, click or leave this button but I don't know how to do this.
2
6534
by: Linda Liu[MSFT] | last post by:
Hi George, Keyboard input introduces the idea of focus. In Windows, a particular element is designated as having the focus, meaning that it acts as the target for keyboard input. The user sets the focus by clicking the mouse or tapping the stylus on the control in question, or by using navigation keys such as the Tab and cursor keys. In principle, any user interface element can receive the focus. The IsFocused property is defined on...
2
8457
by: hnpatel | last post by:
Hi to All, How to use mouse click event for datagridview in c# in vs2005? I m using datagridview in c# application.I had bound data in datagridview.I want to display data in textbox when i click on appropriate row of the datagridview.Grid has only one event "cellcontentclick" is displayed.But i want to use "cellclick" or "selectionchanged" event of datagridview. So plz help me...How to do this....? Thax in advance.......
0
9706
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
10580
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
10323
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,...
1
7621
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
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
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
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.