Adding multiple columns in list boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • papa smerf
    New Member
    • Jul 2006
    • 6

    Adding multiple columns in list boxes

    I have a list box that I want to have 3 columns of data.

    For example:
    FirstName, LastName, Phone, Catagory
    I want to display the FirstName, LastName and Phone in the 3 columns, I will use catagory for sorting.

    I have 4 textboxes to enter the data and a button to add it to the list box.

    I am new to Visual Basic.Net and New to programming in general. I am in a Visual Basic.Net class a the local college, I know how to add data to a list box when there is only one column, but we haven't gotten into multiple columns.

    Thanks
    Gary
  • BSOB
    New Member
    • Jul 2006
    • 77

    #2
    i could be completely wrong, but in my messing around i think ive descovered that listboxes are exactly that; lists. a list is a 1 dimentional array, and has no "columns".
    solution 1:
    multiple textboxes,
    put 4 text boxes side by side. have each data point added to the apporpriate list with the same listindex. then you would have to figure out how to have them scroll togeather.
    solution 2: have one textbox, and seperate your data points with something other than columns. for example use a comma. depending on your application this would make it imposible for the user to select an individual data point without the other 2.

    Comment

    • BSOB
      New Member
      • Jul 2006
      • 77

      #3
      oh yah...
      solution 3:
      design your own object.
      (and send me a copy)
      solution 4:
      have 4 text boxes side by side (multiline = true) with a single vertical scroll bar at the far right. i would have the textboxes in an array. use the scroll bar select the range of data that will be desplayed in the text boxes. at each change of the scroll bar, reinsert each list item in each box.
      solution 5: (and probably best solution)
      a long time ago i got an excel spead sheet onto a form. manipulating it wasnt difficult and proved intuitive. you would be able to show 4 columns and have it scroll vertically. i dont remember if it were a component and where i found it.
      solution 6: (oh! even better!)
      microsoft data grid control. it is a component that comes with visual basic. never used it, but it fits your needs.

      Comment

      • papa smerf
        New Member
        • Jul 2006
        • 6

        #4
        Thanks for the info, but I think I have another way. I padded each word with extra spaces so each word is the same size. I tryed it and it works, but you need to use the right font or else different size letters through the line off.

        Thanks again
        Gary

        Comment

        • iam_clint
          Recognized Expert Top Contributor
          • Jul 2006
          • 1207

          #5
          You might look into Listview try searching google. you might beable to come up with what your looking for.

          Comment

          Working...