?
Solved

Message Box Yes, No, Cancel using BindingNavigatorAddNewItem

Posted on 2008-10-18
10
Medium Priority
?
2,239 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

718 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