Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Referring to the right sender

Referring to the right sender

Scheduled Pinned Locked Moved Visual Basic
csharptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Ekjon
    wrote on last edited by
    #1

    I have this VB .NET app with a generic save method. When a menu item, or a toolbar button or a next button is clicked - if there are any changes it should save with a message. In the code - to identify which was clicked I tried If sender Is ToolBar1.Buttons("ToolBarSave") OrElse sender Is TabMain.Controls("btnAdminDataNext") Then MessageBox.Show("successfully saved!" End If Any idea, why and how to make it work? Thanks.

    D 1 Reply Last reply
    0
    • E Ekjon

      I have this VB .NET app with a generic save method. When a menu item, or a toolbar button or a next button is clicked - if there are any changes it should save with a message. In the code - to identify which was clicked I tried If sender Is ToolBar1.Buttons("ToolBarSave") OrElse sender Is TabMain.Controls("btnAdminDataNext") Then MessageBox.Show("successfully saved!" End If Any idea, why and how to make it work? Thanks.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The code sazmple is incomplete. In what method is this code sitting?? And why should a Save method care about which button launched it?? Any differences between the button and menu functionality shoujld be handled by a seperate method, called by seperate handlers from the menu and button controls.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      E 1 Reply Last reply
      0
      • D Dave Kreskowiak

        The code sazmple is incomplete. In what method is this code sitting?? And why should a Save method care about which button launched it?? Any differences between the button and menu functionality shoujld be handled by a seperate method, called by seperate handlers from the menu and button controls.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        E Offline
        E Offline
        Ekjon
        wrote on last edited by
        #3

        Thanks Dave, I got it fixed.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups