1,105,633 Community Members

Multi Column List Boxes

Member Avatar
jhonnyboy
Junior Poster in Training
97 posts since Jul 2008
Reputation Points: 1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello everyone. I would like to learn how to make a multi column list box. I have set the multi column Boolean to true and set the width but i have yet to see the two columns. I only see one.

I currently have a .csv file and in the format of:

Id, Name

I would like the listbox to have a column for Ids and Names. How would i be able to achieve this?

Member Avatar
Teme64
Veteran Poster
1,039 posts since Aug 2008
Reputation Points: 189 [?]
Q&As Helped to Solve: 208 [?]
Skill Endorsements: 9 [?]
 
0
 

Multi column listbox doesn't actually show items in multiple columns. It "wraps" items to the next column when you add them and the number of the items reaches the listbox's height.

If you want to show items in two columns, you'll have to use some grid control or listview control.

Here's an example with listview control

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  '
  Dim TempStr(1) As String
  Dim TempNode As ListViewItem

  ' Show "hidden" text
  ListView1.ShowItemToolTips = True
  ' Set columnar mode
  ListView1.View = View.Details
  ' Set column header
  ListView1.Columns.Clear()
  ListView1.Columns.Add("UserID", 80)
  ListView1.Columns.Add("Name", 120)
  ' Remove previous items
  ListView1.Items.Clear()
  ' Add two items
  TempStr(0) = "1111"
  TempStr(1) = "Doe, John"
  TempNode = New ListViewItem(TempStr)
  ListView1.Items.Add(TempNode)

  TempStr(0) = "2222"
  TempStr(1) = "Doe, Jane"
  TempNode = New ListViewItem(TempStr)
  ListView1.Items.Add(TempNode)

End Sub
Member Avatar
jhonnyboy
Junior Poster in Training
97 posts since Jul 2008
Reputation Points: 1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you for your fast response!

Question Answered as of 5 Years Ago by Teme64
danprash
Newbie Poster
1 post since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

Thanks a ton man Very helpful....!

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article