|
-
May 14th, 2006, 03:18 PM
#1
Thread Starter
Addicted Member
listbox only 5lines
Hi,
can somebody show me how to add 5 lines to a listbox..if thiers anymore..it replaces the first line so all the rest get moved down.
line = line + 1
if line = < 5 then
frmtest.list1.additem , , "hello"
else
frmtest.list1.additem , , "i wanna start from the top"
-
May 14th, 2006, 03:19 PM
#2
Re: listbox only 5lines
Something like the following may work for you:
VB Code:
Dim i As Integer
For i = 1 To 5
List1.AddItem "Item" & i
Next i
-
May 14th, 2006, 03:27 PM
#3
Thread Starter
Addicted Member
Re: listbox only 5lines
thnx, but i need help with moving the lines down and starting from the top realy..somebody helped me before but posts gone now.
they used -1 i think or summit to get back to the top.
while were on the subject i plan to use this to display events that taken place in a game in a history window..
i didnt do it lasttime because the string was usually to large for the listbox, and i didnt want no horizontle scroller..perhaps thiers a better control for me to us
-
May 14th, 2006, 03:30 PM
#4
Re: listbox only 5lines
You can use the index parameter when adding to the listbox
VB Code:
If List1.ListCount < 5 Then
List1.AddItem "Hello"
Else
List1.RemoveItem 4
List1.AddItem "i wanna start from the top", 0
End If
EDIT: probably better
VB Code:
List1.AddItem "the new item", 0
If List1.ListCount = 6 Then
List1.RemoveItem 4
End If
casey.
-
May 14th, 2006, 03:40 PM
#5
Thread Starter
Addicted Member
Re: listbox only 5lines- RESOLVED
up index param will hlp, i never had to use the removeitem to do it before tho..but aslong as it works it works...
thnx alot for the help
-
May 14th, 2006, 06:46 PM
#6
Re: listbox only 5lines
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
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
|