Listbox
Page 1 of 1 • Share •
Listbox
Well i will try to tell you some basics about the listbox
I will explain it using a textbox.
This is what you will need:
- 1 Form
- 1 ListBox
- 1 TextBox
----------------------------
PART 1
----------------------------
If you double click the form you can add a code that it needs to load on the begin that the program starts, so we will add the items for the listbox there.
To add an item to the list box we need to use
Now your listbox has 3 items; Car, Plane and Bike
----------------------------
PART 2
----------------------------
you need the to add this code:
(READ THIS) if you add an item thats called "car" in part 1 and you will add it like "Car" in part 2 it won't work.
BASIC EXPLANATION
So its like this, If the selected item of listbox1 is "Car" then the text in textbox1 is "You selected the Car"
Good Luck =)
DOWNLOAD LINK FOR THE SOURCE : HERE
I will explain it using a textbox.
This is what you will need:
- 1 Form
- 1 ListBox
- 1 TextBox
----------------------------
PART 1
----------------------------
If you double click the form you can add a code that it needs to load on the begin that the program starts, so we will add the items for the listbox there.
To add an item to the list box we need to use
- Code:
ListBox1.Items.Add("Car")
ListBox1.Items.Add("Plane")
ListBox1.Items.Add("Bike")
Now your listbox has 3 items; Car, Plane and Bike
----------------------------
PART 2
----------------------------
you need the to add this code:
- Code:
If ListBox1.SelectedItem.Equals("Car") Then
TextBox1.Text = "You selected the Car"
ElseIf ListBox1.SelectedItem.Equals("Plane") Then
TextBox1.Text = "You selected the Plane"
ElseIf ListBox1.SelectedItem.Equals("Bike") Then
TextBox1.Text = "You selected the Bike"
End If
(READ THIS) if you add an item thats called "car" in part 1 and you will add it like "Car" in part 2 it won't work.
BASIC EXPLANATION
So its like this, If the selected item of listbox1 is "Car" then the text in textbox1 is "You selected the Car"
Good Luck =)
DOWNLOAD LINK FOR THE SOURCE : HERE

Robin- Moderator

- Number of posts: 11
Age: 18
Location: Holland
Registration date: 2008-08-31
Permissions of this forum:
You cannot reply to topics in this forum





