|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to create ListBox in VB.net? I am very new to the Programming Language. I have started learning VB.Net recently. Now I am trying to make a form which requires a ListBox into it. Does anyone know how to create ListBox in VB.Net.?? Please tell me as I am newbie in the programming languages.!! Also if possible provide some more codes.! I am hoping for the help as soon as possible.
__________________ The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. -Joe Martin ![]() |
#2
| |||
| |||
Re: How to create ListBox in VB.net? You can use the following steps to program Listbox Functionality in VB.net :
|
#3
| |||
| |||
Re: How to create ListBox in VB.net? You can use the following guides for creating the ListBox in VB.net : For creating a new VB.NET Windows forms ListBox, you can use the code \ Code: Dim listbox As New ListBox Code: listbox.Location = New Point(0, 0) Code: Me.Controls.Add(listbox) Code: listbox.SelectionMode = SelectionMode.MultiExtended Code: Dim s1 As String = "DELL" Dim s2 As String = "HP" Dim s3 As String = "SONY" listbox.Items.AddRange(New String() {s1, s2, s3}) |
#4
| |||
| |||
Re: How to create ListBox in VB.net? For making a selection of items we make the ListBox control. THe advantage of making the ListBox Control is that we can select one or more than one of the items from the list. The ListBox control is based on the ListControl class which is based on the Control class. The SelectedIndexChanged is the default event of ListBox, which looks like the following code : Code: Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged End Sub |
#5
| |||
| |||
Re: How to create ListBox in VB.net? If you want to display the index of an item you can use the following code : Code: Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedIndex 'using the selected index property of the list box to select the index End Sub Code: Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,_ ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedItem 'using the selected item property End Sub |
![]() |
|
Tags: listbox, listcontrol, programming language, vb net |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I add a Listbox header using VBA in Excel | FullTimepass | MS Office Support | 2 | 25-01-2012 04:55 PM |
ListView or ListBox | Heather5 | Software Development | 3 | 29-08-2009 12:10 AM |
C# Listbox control | abhinavm | Software Development | 2 | 07-08-2009 11:01 PM |
ListBox Drop down menu in vb.net | SamsherR | Software Development | 3 | 16-02-2009 04:46 PM |
I have a problem with listbox | StoaVio | Software Development | 2 | 25-10-2008 03:33 PM |