Solved

Are u sure u want to delete row?

Posted on 2006-10-27
4
242 Views
Last Modified: 2010-04-16
I need a message box asking the user if he wants to delete row?
0
Comment
Question by:mathieu_cupryk
  • 3
4 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 17818579
can u be more specific how do the user delete the row ?
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 17818583
by using the delete key in the grid (it's a grid rt)

or by using some button in the form ?
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 250 total points
ID: 17818597
u could trap the delete key press in the grid in the grid key down..like


//hook event in constructor
AGrdi.KeyDown += new System.Windows.Forms.KeyEventHandler(AGrdi_KeyDown);




private static void AGrdi_KeyDown(object sender
                  , System.Windows.Forms.KeyEventArgs e)
            {
                  if(e.KeyCode == System.Windows.Forms.Keys.Delete)
                  {
                        System.Windows.Forms.DialogResult Result =
                              System.Windows.Forms.MessageBox.Show
                              ("Question","Mesage Caption",System.Windows.Forms.MessageBoxButtons.YesNo
                              ,System.Windows.Forms.MessageBoxIcon.Question);
                        if(Result == System.Windows.Forms.DialogResult.Yes)
                        {
                              //Delete Logic
                        }
                              
                  }
            }
0
 
LVL 11

Expert Comment

by:anyoneis
ID: 17824900
If you are using a DataGridView, set AllowUserToDeleteRows False, and provide a button to delete the selected grid row.

David
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple Injector with Web Service 4 54
Can I command line build a C# application? 6 40
I need help with Crystal Report's Parameter Prompt Form 2 49
abstract class C# 1 31
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question