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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

Calling on BindingNavigator Controls from other controls

I created a great program with multiple binding navigators for easy code and run tactics.  However I wrote the application for a bunch of old fogeys that can't grasp the bindingnavigator functionality.  What they want is big easy to read ADD NEW RECORD, DELETE and SAVE record buttons.  I was thinking I could make the bindingnavigator invisible and add manual buttons and call upon the bindingnavigators built in functions.  However, that has been a bit more challenging than I though.  I tried the below code to mimic the keypress of the add button on the bindingnavigator but the read only property of sender.Pressed = false whereas if the bindingnavigator does it, it's a true value.  Am I going about this the wrong way? Or am I missing something?
 
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click

    End Sub

    Private Sub Button_add_aap_programs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_add_aap_programs.Click

        Dim oSender As System.Windows.Forms.ToolStripButton = DirectCast(ToolStripButton1, System.Windows.Forms.ToolStripButton)

        ToolStripButton1_Click(oSender, e)

    End Sub

Open in new window

0
MrFantastic6
Asked:
MrFantastic6
  • 2
1 Solution
 
John (Yiannis) ToutountzoglouCommented:
You may delete also these buttons of the binding navigator and create your own button calling your own functions without reffering to bind.nav controls.
0
 
MrFantastic6Author Commented:
I figured it out.  I like the bindingnavigator and saves me from having to call my own functions.  Here's what I had to do:


Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click 
  'the function for adding a record called by navigator 
End Sub 
 
    Private Sub Button_add_aap_programs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_add_aap_programs.Click 
 
        Dim oSender As System.Windows.Forms.ToolStripButton = DirectCast(ToolStripButton1, System.Windows.Forms.ToolStripButton) 

osender.PerformClick()

 
    End Sub

Open in new window

0
 
MrFantastic6Author Commented:
I was missing the oSender.PerformClick() function.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now