VB.NET Simple Menu - IndexChanged Events


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.

How do You Feel after reading this?

According to scientists, we humans have 8 primary innate emotions: joy, acceptance, fear, surprise, sadness, disgust, anger, and anticipation. Feel free to tell us how you feel about this article using these emotes or via the comment section. This feedback helps us gauge our progress.

Help me Grow.

I set myself some growth ambitions I desire to achieve by this year's end regarding this website and my youtube channel. Am halfway. Help me reach them by:




Recommendations


What do You Think


Previous Post Next Post