Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

double click listbox

$
0
0
i wanted to do is when i double click item in listbox then the region will display in textbox ...please help me for my assignment ..can anyone can give me idea how to do it..
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.BackColor = Color.Chocolate
        Label1.ForeColor = Color.Blue
        Label1.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label2.ForeColor = Color.Blue
        Label2.Font = New Font(Font.Name, 12, FontStyle.Regular)
        '   ListBox1.Text = "Province"
        ListBox1.Items.Add("Isabela")
        ListBox1.Items.Add("Tarlac")
        ListBox1.Items.Add("Bulacan")
        ListBox1.Items.Add("Cebu")
        ListBox1.Items.Add("Bohol")
        ListBox1.Items.Add("Negros")
        ListBox1.Items.Add("Davao")
        ListBox1.Items.Add("Cotobato")
        ListBox1.Items.Add("Zamboanga")
        ListBox1.ForeColor = Color.Blue
        Label3.Text = "Province:"
        Label3.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label3.ForeColor = Color.Blue
        Label4.Text = "Isabela"
        Label4.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label4.ForeColor = Color.Blue
        Label5.Text = "Tarlac"
        Label5.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label5.ForeColor = Color.Blue
        Label6.Text = "Bulacan"
        Label6.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label6.ForeColor = Color.Blue
        Label7.Text = "Cebu"
        Label7.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label7.ForeColor = Color.Blue
        Label8.Text = "Bohol"
        Label8.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label8.ForeColor = Color.Blue
        Label9.Text = "Negros"
        Label9.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label9.ForeColor = Color.Blue
        Label10.Text = "Davao"
        Label10.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label10.ForeColor = Color.Blue
        Label11.Text = "Cotobato"
        Label11.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label11.ForeColor = Color.Blue
        Label12.Text = "Zamboanga"
        Label12.Font = New Font(Font.Name, 12, FontStyle.Regular)
        Label12.ForeColor = Color.Blue


        '  ListBox1.SetSelected(2, True)
        '   ListBox1.SetSelected(4, True)
        '   ListBox1.SetSelected(8, True)
        ' ;   ListBox1.SetSelected(10, True)
  

            ' & " Is On NCR Region"
        ' ListBox1.Items.Add(TextBox1.Text)
        '  End If
        'NCR REGION:
        'isabela.tarlac,bulacan
        'Visayan Region
        'cebu,bohol,negros
        'mindanao region 
        'davao,cotobato,zamboanga

    End Sub

    
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  
    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        If ListBox1.SelectedItem = "Tarlac" Then
            TextBox1.Text = "Tarlac Is Ncr Region"
            Label5.BackColor = Color.White
        End If


        '  TextBox1.Text = "Here are the selected items: "&  & " "

    End Sub
End Class


file:///C:/Users/buddah15/Documents/3.png

thanks in advanced

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>