Referring to the right sender
-
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. -
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.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 -
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