(VB6) How can I have a MultiColumn ListBox? (Emergency)-VBForums
Results 1 to 19 of 19

Thread: (VB6) How can I have a MultiColumn ListBox? (Emergency)

  1. #1

    Thread Starter
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Resolved (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Hello

    It's 4 days I'm searching google and asking different people about how to have a "multicolumn" listbox, but nobody could help.

    Some say :"Use a ListView", but I can't find "ListView" in "Components" list.
    Some say : "Add single strings with "vbTab" characters to your "Single-Column" listbox, so that it seems to be "Multicolumn", but this is only useful for specific "Fonts" and doesn't always work properly.
    Some say: Use a DataGrid, but I don't want a grid or table, I want a listbox. (So that when I select a field, the whole record (row) is selected)

    I also tried using "MS-Forms 2.0 Listbox", but all professionals are saying : It has distributional problems. "

    I am getting frustrated. Can anybody please give me a good advice for either adding multicolumn data to a regular listbox or adding a new component to my project that really be a "Multi-column" listbox?

    Thank you very much
    Last edited by javad2000; Dec 20th, 2006 at 11:31 AM.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    You can find the ListView if you go to Projects|Components and select Microsoft Common Controls 6.0.

    I've attached an example that uses it.
    Attached Files Attached Files

  3. #3
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,915

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    It's as simple as setting the Columns property to whatever value suits.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by pnish
    It's as simple as setting the Columns property to whatever value suits.
    Yes but it results in a difficult to manage control.

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by pnish
    It's as simple as setting the Columns property to whatever value suits.
    It has no value what so ever...
    As Martin mentioned using Listview control is much better option, however take a look at this sample - not exactly columns but imitation.

  6. #6
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,531

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    I faced a similar problem in the past and this is how it was solved. (credits to Hack)
    Have a like at this post.
    Multi-column Listbox

    Pradeep
    Last edited by Pradeep1210; Dec 10th, 2006 at 12:10 PM.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  7. #7

  8. #8
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,915

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by MartinLiss
    Yes but it results in a difficult to manage control.
    Works for me. But most of the data I display in multiple columns is fixed length. It can get a bit unmanageable with varying length data I agree.
    Quote Originally Posted by javad2000
    It's 4 days I'm searching google and asking different people about how to have a "multicolumn" listbox, but nobody could help.
    The answer to the question is Set the listbox's Column property.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by pnish
    The answer to the [javad2000's] question is Set the listbox's Column property.
    No, it isn't - all it does it creates a list with sort of horizontal layout rather than vertical so "columns" are pretty useless - unlike those found in nthe Listview or some Grid control.

  10. #10
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,915

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    As I said, it works for me. By setting the Columns property it creates 'snaking' columns in the listbox which are populated vertically then horizontally, ie 'down then across' which is perfect for my purpose. Let's just agree to disagree shall we?
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  11. #11
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    We may agree or disagree - who cares? The point is - what you (and original developer of that listbox) refer as "Column" isn't exactly column.
    Column (by definition I guess) is data presented in the columnar (true vertical) way. Also, columns usually have column headers.
    Columns in the "columnar" listbox are depending on the height of listbox so control is populated "horizontally" as soon as the "bottom" is reached...
    How can anyone consider that a columns I have no idea (but I know that it "serves your purpose").

    Regards.

  12. #12
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,915

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by RhinoBull
    We may agree or disagree - who cares?
    Exactly
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  13. #13

    Thread Starter
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Thank you everybody.
    I found the listview and I also think it's the best choice.

  14. #14
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.

  15. #15

    Thread Starter
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    I have faced a problem with ListView.
    The ListView doesn't have a "Right-to-Left" property, and I want it to be "Right to Left", because my language is Farsi.
    I'm getting frustrated. Isn't there a good Multi-Column Listbox in VB6?

    Thank you

    Quote Originally Posted by javad2000
    Thank you everybody.
    I found the listview and I also think it's the best choice.

  16. #16

  17. #17

    Thread Starter
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    That would help if I was a professional, but I'm not looking for API methods, I'm looking for an easy and clean way to show my multi-column data in a "List". So that the SelectionMode is "By Row".

    Thank you

  18. #18

  19. #19

    Thread Starter
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Re: (VB6) How can I have a MultiColumn ListBox? (Emergency)

    Quote Originally Posted by MartinLiss
    Are you willing to use a fixed width font like this one?
    Yes, and I know how to use this method to make Signle-column Listboxes appear in "Multi-column" view, but I don't know which Farsi font is a 'fixed-width font'. I will ask it from my persian freids.

    If there is a better way to make "multi-column" listboxes, please let me know.

    Thank you
    Last edited by javad2000; Dec 21st, 2006 at 04:33 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.