Results 1 to 7 of 7

Thread: Listbox add items to the top.

  1. #1

    Thread Starter
    Addicted Member VBGangsta's Avatar
    Join Date
    Aug 2003
    Location
    New York
    Posts
    219

    Listbox add items to the top.

    hi, i am adding items to a listbox like:ListBox1.Items.Add("test")
    and i was wondering if there is a way to make it add items to the begining of the listbox instead of putting it at the end. Thanks
    -Rob

  2. #2
    Lively Member
    Join Date
    Nov 2003
    Location
    Iowa
    Posts
    96
    This is a good question!
    It is like wiping your ass with silk, I love it!

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    like this...
    VB Code:
    1. ListBox1.Items.Insert(0, "testing") '/// where 0 is the first index number.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    try this


    Code:
        Private Sub btn_add2end_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_add2end.Click
            ListBox1.Items.Insert(<any index>, "your item")
        End Sub
    where <anyindex> is between 0 and listbox1.items.count
    Last edited by persianboy; Nov 11th, 2003 at 12:55 AM.

  5. #5
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    he wants them at the beginning though
    i was wondering if there is a way to make it add items to the begining of the listbox
    so that'd be 0 rather than the ListBox1.Items.Count.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  6. #6
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    yeah , fixed it

  7. #7

    Thread Starter
    Addicted Member VBGangsta's Avatar
    Join Date
    Aug 2003
    Location
    New York
    Posts
    219
    Thank you very much!!!
    -Rob

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