'In my toolbar i created a property mode and an event change_entry_mode 'and on every button click i changed the property and raised the event Public Class UserControl1 Public Event change_entry_mode() Private entry_mode As String = "" Public Property mode() As String Get Return entry_mode End Get Set(ByVal value As String) entry_mode = value End Set End Property Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub Private Sub Add_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Add_Button.Click entry_mode = "ADD" RaiseEvent change_entry_mode() End Sub Private Sub Edit_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Edit_Button.Click entry_mode = "MOD" RaiseEvent change_entry_mode() End Sub Private Sub Delete_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Delete_Button.Click entry_mode = "DEL" RaiseEvent change_entry_mode() End Sub End Class
'This is my form where this usercontrol i.e. toolbar placed 'I just created a sub which handles change_entry_mode Public Class Instr Private Sub maintoolbarclick() Handles UserControl11.change_entry_mode Select Case Me.UserControl11.mode Case "ADD" MsgBox("Add Button Clicked") Me.UserControl11.mode = "" Case "MOD" MsgBox("Edit Button Clicked") Me.UserControl11.mode = "" End Select End Sub End Class