Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Listboxes VB.NET

Posted on 2013-06-10
3
Medium Priority
?
271 Views
Last Modified: 2013-06-12
I am very new to VB.NET.  I have approx. 6+ years with VB6 and VBA.  I have just turned to VB.NET approx. 2 weeks ago and I have gotten a connection to my sql server.  I know how to retrieve data.  The problem I am having is showing records in a ListBox with columns and column heads.  I have gotten it to show 1 column and if I click on the row, it goes to the record, but I can not figure out how to make it show more than one column and how to make it show column heads.  I am using VB.NET 2012.  Any help would be greatly appreciated.  Also if you have an suggestions as to resources please tell me.  I have gotten a very decent book, but it doesn't cover this.  Thanks in advance!
0
Comment
Question by:russell12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 1000 total points
ID: 39234063
instead of listbox use ListView,
in the properties pane u can add columns and change different properties of the listview like FullRowSelect, GridLines, BackColor etc.

check this tutorial:
http://www.tutorialspoint.com/vb.net/vb.net_listview.htm
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 39234624
The ListBox does not enable multiple columns and headers. If you really need those, use a ListView as suggested by sedgwick.

But the ListBox takes less space in the Form and requires less resources than a ListView.

Columns header are very often useless, because most user will recognize the information by its content. If you do not really need the column headers, you can often use a concatenation in the stored procedure or SQL statement in order to display the values of 2 database columns in the single column of a ListBox.

As an example, a LastName and FirstName fields can be concatenated into one that displays

Doe, John
Burger, James

An Address, City, State and ZipCode combination can also be concatened to something like the following.

123 MyStreet, New York, NY 12345
456 YourStreet, Albany, NY 45678

This can be displayed in the ListBox single column.
0
 
LVL 2

Author Closing Comment

by:russell12
ID: 39242585
Thanks for both of your inputs, they were both very helpful informational!
Russell
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question