Answers for "listbox selected vb.net"

VBA
0

listbox selected vb.net

Public Class Form1
   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      ' Set the caption bar text of the form.  
      Me.Text = "tutorialspont.com"
      ListBox1.Items.Add("Canada")
      ListBox1.Items.Add("USA")
      ListBox1.Items.Add("UK")
      ListBox1.Items.Add("Japan")
      ListBox1.Items.Add("Russia")
      ListBox1.Items.Add("China")
      ListBox1.Items.Add("India")
   End Sub
  
   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      MsgBox("You have selected " + ListBox1.SelectedItem.ToString())
   End Sub
   
   Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) 
      Handles ListBox1.SelectedIndexChanged
      Label2.Text = ListBox1.SelectedItem.ToString()
   End Sub
End Class
Posted by: Guest on July-12-2021

Code answers related to "listbox selected vb.net"

Code answers related to "VBA"

Browse Popular Code Answers by Language