Solved

Are u sure u want to delete row?

Posted on 2006-10-27
4
239 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now