How to write out button event without using WPF controls?

78 views Asked by At

I do not know how to specify in the title, this is in WPF visual basic. I want to know how do I write a code so that when a button is clicked, the tabcontrol selection will be = 1

Here is what I have in my MainWindow, RightWindowCommands:

 <Button Content="Information" Cursor="Hand" Click="InformationButton_OnClick"
                      ToolTip="View the information"
                      x:Name="InformationView"/>

However, I did not use the WPF tools' Button, as this is a GUI that I have to place the button at RightWindowCommands, I want to know how to come out with the code so that InformationButton_OnClick gives me tabControl.SelectedIndex = 1. Please guide me on writing this code out

1

There are 1 answers

0
DeJaVo On BEST ANSWER

Here is a nice example for onclick event handling a picture, you can change it to a number instead of picture.

`AddHandler pic.Click, AddressOf pic_Click'

Private Sub pic_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim pic As PictureBox = DirectCast(sender, PictureBox)
    ' etc...
End Sub

Source : add on click event to picturebox vb.net