VB.NET Simple Menu - IndexChanged Events

July 16, 2017 Oclemy VB.NET Menu 0 minutes, 24 seconds

Here is simple VB.NET menu example.We select a menu item and show a Message Dialog with selected item.

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ToolStripComboBox1.Items.Add("Asia")
        ToolStripComboBox1.Items.Add("Africa")
        ToolStripComboBox1.Items.Add("America")
        ToolStripComboBox1.Items.Add("Europe")

    End Sub

    'SELECTION CHANGES
    Private Sub ToolStripComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
        MessageBox.Show(ToolStripComboBox1.SelectedItem.ToString() + " " + ToolStripComboBox1.SelectedIndex.ToString())
    End Sub
End Class

Best Regards.

Comments