|
-
Jul 3rd, 2009, 06:01 PM
#1
Thread Starter
New Member
Use of ListBox
I'm doing a project in database development which requires to use a list box that will populate from a SQL Server database.
I'm confused on setting up the listbox to have multiple columns that will be populated from a stored procedure within SQL.
I drag and drop the listbox onto the form, size it, change it's property to multi-column, set column width to 10, but don't know what to do next.
The listbox on the form design doesn't show multi-columns.
-
Jul 3rd, 2009, 11:55 PM
#2
Re: Use of ListBox
I assume that you're using VB.NET. This is question has nothing to do with databases so it belongs in the VB.NET forum, not Database Development forum. I've asked the mods to move it.
You misunderstand what MultiColumn property of the ListBox is for. A ListBox can only display a single list of data. Normally, that list is displayed vertically with any overflow requiring the user to scroll downwards. When you set MultiColumn to True the overflow is displayed to the right. If the ListBox is only tall enough to display 5 items say, the sixth item will be displayed in a second column, so no vertical scrolling is required. The eleventh item will be displayed in a third column, etc.
If you actually want to display multiple columns from the data source to the user then the ListBox is not really the right choice. It can be hacked to appear to display multiple columns but it's just not worth it. You should either use a ListView and set the View to Details or else use a DataGridView. The DataGridView is generally the best option as it supports data binding and provides a great deal of flexibility and customisablility.
-
Jul 4th, 2009, 12:12 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|