//File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Input Namespace WpfApplication1.IncludeApplicationDefinition Public Partial Class MyWindow Inherits Window Public Sub New() InitializeComponent() End Sub Private Sub ButtonOnClick(sender As Object, args As RoutedEventArgs) Dim btn As Button = TryCast(sender, Button) MessageBox.Show(Convert.ToString(btn.Content) & "' has been clicked.") End Sub End Class End Namespace