CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2001
    Posts
    9

    Create New Listobox at Run-Time

    I know how to create New Forms using the "NEW" method. How can this be done to create ne List boxes??


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Create New Listobox at Run-Time

    You have to have one listbox already on the form (although it doesn't have to be visible). Set it's Index property to 0. Then in your code:



    load listboxname(1)
    load listboxname(2)
    load listboxname(3)

    'etc. until you have as many as you need






  3. #3
    Join Date
    Jul 2001
    Location
    maharashtra,india
    Posts
    181

    Re: Create New Listobox at Run-Time

    Private Sub Command1_Click()
    Dim lst As ListBox
    Set lst = Controls.Add("vb.listbox", "lst")
    lst.Visible = True
    End Sub
    then u can set its left,right,etc...


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

Featured