Solved

Message Box Yes, No, Cancel using BindingNavigatorAddNewItem

Posted on 2008-10-18
10
2,223 Views
Last Modified: 2012-06-21
I need a Message Box for Yes, No, Cancel using the BindingNavigatorAddNewItem.

I have tried several samples but none will cancel the addnew.

Thanks for your help!
0
Comment
Question by:dave_sky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 18

Expert Comment

by:Priest04
ID: 22752674
Say that again?
0
 

Author Comment

by:dave_sky
ID: 22752956
When a user adds a new row to a datagridview using the BindingNavigatorAddNewItem button -
I need a Message Box for Yes, No, Cancel.

Or, using this code:
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
        If MessageBox.Show("Are you are sure you want to create a new blank Quote?", _
                       "You could make a copy.", _
       MessageBoxButtons.YesNo) = DialogResult.Yes Then
            Me.TblIncomeStatementBindingSource.AddNew()
        End If
    End Sub

How can I modify - "MessageBoxButtons.YesNo) = DialogResult.Yes Then
            Me.TblIncomeStatementBindingSource.AddNew()"

To DialogResult.No instead of DialogResult.Yes?




 
0
 

Author Comment

by:dave_sky
ID: 22753294
Maybe a better way of summarizing this question:
How to cancel adding a new datagridview row after pressing the BindingNavigatorAddNewItem button?
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 18

Accepted Solution

by:
Priest04 earned 500 total points
ID: 22753336
In the property window of the BindingNavigator, find property AddNewItem and set it to None. This will allow you to add record manually, like in the code you have provided.

Goran
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22753343
No need to cancel it, this way adding is not started, unless you manually call AddNew method.
0
 

Author Comment

by:dave_sky
ID: 22753372
The AllowUserToAddRows property is already set to 'False".

I have no problem adding the new row - I want to be able to cancel the adding of the new row with a messagebox.
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22753395
dave, where did I talked about setting AllowUserToAddRows to false? Read my reply thoroughly.

If you want this:

- user clicks on + button to add new record
- messagebox pops out aksing the user if he want to add a record
- if yes, start adding new record, if no, nothing happened, adding new record is not started

then this is what your code will do, when you set the property I talked about.
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22753403
And btw, you dont need Yes, No and Cancel, only Yes and No, what will be the difference between no and cancel?
0
 

Author Comment

by:dave_sky
ID: 22753429
Priest04,

Ok, I finally got the message - Works fine.

This will solve a lot of other bindingnavigator messagebox problems for me.

Thank you!
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22753435
You are welcome.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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