|
-
Jun 24th, 2000, 12:07 PM
#1
Thread Starter
New Member
Hi again. I'm in a bit of trouble. The project I'm working on needs the use of listboxes, but I haven't the slightest idea how to use them. Could anyone give me a quick overview?
--
VB6 Professional
-
Jun 24th, 2000, 12:57 PM
#2
Hyperactive Member
Quick overview
Okay, here are the most usable functions of a listbox, to try this project, do the following:
- Make a new project
- Add a listbox-control
- Add three command-buttons
- Add this code:
Code:
Private Sub Command1_Click()
List1.AddItem InputBox("Type something", "New list item", "hello world")
End Sub
Private Sub Command2_Click()
For x = 0 To List1.ListCount - 1
If List1.ListCount = 0 Then Exit For
If List1.Selected(x) Then
MsgBox "The data: " & List1.List(x) & " is selected."
Exit For
End If
Next x
End Sub
Private Sub Command3_Click()
List1.Clear
End Sub
Hitting the first button will ask you for any text which will be added as a row in the listbox. The second button will show you what's selected, if empty or if none selected it doesn't do anything. Third button will clear the listbox.
This should get your running...
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 24th, 2000, 10:56 PM
#3
PowerPoster
By the way, what you need to do with the ListBox Control? The ListBox control only can list all the Item that you've added into thier list, either at Design Time or Runtime.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|