How to add Listbox Header

Discussion in 'AutoCAD' started by Stanley, Jan 14, 2005.

  1. Stanley

    Stanley Guest

    Hello everyone,

    I need to use a multi-column listbox in my VBA user defined form.
    As the following codes initialize the ListBox1 to have multi-columns
    then add data to the listbox.
    ++++++++++++++++++++++++++++++++++++++++

    Me.ListBox1.Clear
    Me.ListBox1.ColumnCount = 3
    Me.ListBox1.ColumnHeads = True
    Me.ListBox1.ColumnWidths = "100;100;100"

    For i = 0 To UBound(Array1)
    Me.ListBox1.AddItem Array1(i).No
    Me.ListBox1.Column(1, i) = Array1(i).Name
    Me.ListBox1.Column(2, i) = Array(i).Address
    Next i

    ++++++++++++++++++++++++++++++++++++++++

    The resulting listbox have an empty header at the 1st row.
    My 1st problem is how to add a header to the listbox.

    2nd, the column width have been fixed, if the content too long
    how can I adjust the individual column width interactively.

    Thanks in advance.

    Stanley.
     
    Stanley, Jan 14, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.