Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Message Box Yes, No, Cancel using BindingNavigatorAddNewItem

Posted on 2008-10-18
10
Medium Priority
?
2,265 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Accepted Solution

by:
Priest04 earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

876 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