Results 1 to 6 of 6

Thread: listbox only 5lines

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    146

    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"

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    146

    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

  4. #4
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: listbox only 5lines

    You can use the index parameter when adding to the listbox
    VB Code:
    1. If List1.ListCount < 5 Then
    2.  List1.AddItem "Hello"
    3. Else
    4.  List1.RemoveItem 4
    5.  List1.AddItem "i wanna start from the top", 0
    6. End If

    EDIT: probably better
    VB Code:
    1. List1.AddItem "the new item", 0
    2.  
    3.  If List1.ListCount = 6 Then
    4.   List1.RemoveItem 4
    5.  End If
    casey.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    146

    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

  6. #6
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: listbox only 5lines

    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width