How to add results to listbox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to add results to listbox

FidzFidz Posts: 26Member
Hi
I am not too sure about the code to add results that are calculated to the listbox...This program will convert from eg inches to centimeters and the results will be diplayed in the respective colunm heading...The colunm heading will come from the cbobox...Talking about column headings please can someone also help me out on how I could get the column heading on too...Thanks

Comments

  • ColdShineColdShine Posts: 597Member
    You would probably want to use a ListView control, as it incorporates column headers management. It's no more difficult to program than a ListBox control.
    Hope this helps.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www16.brinkster.com/rafonline[/size]

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : You would probably want to use a ListView control, as it incorporates column headers management. It's no more difficult to program than a ListBox control.
    : Hope this helps.
    : _____________________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    : http://www16.brinkster.com/rafonline[/size]
    :
    :

    If it's that easy, then I'd like to make a quick request. How do you use the listview control? I've tried a few times, but never gotten very far. Basically, I want something that looks and acts like a listbox, but has multiple columns. With the right number of characters, the tab character works fine to make several columns, but that just doesn't work for me. I had given up and made my own listbox, but it is sorely lacking in useability...
  • ColdShineColdShine Posts: 597Member
    : How do you use the listview control?
    Could be entirely different from what you need...

    : I want something that looks and acts like a listbox, but has multiple columns.
    ListView with FullRowSelect = True, HideColumnHeaders = True, View = lvwReport. In design mode, create the columns you need (they won't show, but you must specify their widths and text alignments), and in run time add the Items and SubItems you want.

    : With the right number of characters, the tab character works fine to make several columns, but that just doesn't work for me.
    The ListView will make you forget the tab ASCII code, and even the meaning of the word "tab"...

    : I had given up and made my own listbox, but it is sorely lacking in useability...
    I think the ListView and TreeView are the most complex pieces of software existing in the Windows world.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www16.brinkster.com/rafonline[/size]

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : : How do you use the listview control?
    : Could be entirely different from what you need...
    :
    : : I want something that looks and acts like a listbox, but has multiple columns.
    : ListView with FullRowSelect = True, HideColumnHeaders = True, View = lvwReport. In design mode, create the columns you need (they won't show, but you must specify their widths and text alignments), and in run time add the Items and SubItems you want.
    :
    : : With the right number of characters, the tab character works fine to make several columns, but that just doesn't work for me.
    : The ListView will make you forget the tab ASCII code, and even the meaning of the word "tab"...
    :
    : : I had given up and made my own listbox, but it is sorely lacking in useability...
    : I think the ListView and TreeView are the most complex pieces of software existing in the Windows world.
    : _____________________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    : http://www16.brinkster.com/rafonline[/size]
    :
    :

    AHHHHH!!!! I figured it out finally. People keep telling me to use FullRowSelect, but it doesn't have it! v5 doesn't, v6 does but I don't normally have v6.

    Last questions (some of which I could figure out if no one was helping me...):
    How do I add, remove, etc. items? Can they be moved or do I need to remove and re-add in the new spot? Does it have an itemdata property or can I make a hidden column?

    I think that's all...for now, at least.
  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : : How do you use the listview control?
    : Could be entirely different from what you need...
    :
    : : I want something that looks and acts like a listbox, but has multiple columns.
    : ListView with FullRowSelect = True, HideColumnHeaders = True, View = lvwReport. In design mode, create the columns you need (they won't show, but you must specify their widths and text alignments), and in run time add the Items and SubItems you want.
    :
    : : With the right number of characters, the tab character works fine to make several columns, but that just doesn't work for me.
    : The ListView will make you forget the tab ASCII code, and even the meaning of the word "tab"...
    :
    : : I had given up and made my own listbox, but it is sorely lacking in useability...
    : I think the ListView and TreeView are the most complex pieces of software existing in the Windows world.
    : _____________________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    : http://www16.brinkster.com/rafonline[/size]
    :
    :

    I think I've figured part of it out, though it seems a bit clumsy. This is what I have so far:
    [code]
    Dim t As ListItem
    Set t = ListView1.ListItems.Add(, , "C1")
    t.ListSubItems.Add , , "C2"
    t.ListSubItems.Add , , "C3"
    [/code]
    A bit more and I may have it all worked out.

    I assume I'll have to remove and re-add to move an item?

    Is a column width of 0 the only way to hide one?
  • ColdShineColdShine Posts: 597Member
    : Can they be moved or do I need to remove and re-add in the new spot?
    Same as ListBox...

    : Does it have an itemdata property or can I make a hidden column?
    Every ListItem has a Tag ([blue]Variant[/blue]) property. Do with it as you will.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www20.brinkster.com/coldshine[/size]

  • ColdShineColdShine Posts: 597Member
    : I assume I'll have to remove and re-add to move an item?
    You've got it.

    : Is a column width of 0 the only way to hide one?
    Yes, it is. But keep in mind your final user will be able to track and resize the column header, thus revealing any data in the column.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www20.brinkster.com/coldshine[/size]

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : Yes, it is. But keep in mind your final user will be able to track and resize the column header, thus revealing any data in the column.
    : _____________________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    : http://www20.brinkster.com/coldshine[/size]

    Nah, no header, remember? Even if they do see what's in the column, it's not a big deal. Each item is related to a file and the hidden column is simply the name of the file.

    Thanks a million!
Sign In or Register to comment.