473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

listbox with multiple columns

i need to display 2 columns of data in a list box.

how would i set this up IN CODE.

say my table is tblNames, and i have 2 fields, FirstName, LastName, and want
the data to show up in 2 columns, LastName, followed by FirstName

normally i would say

ListBox1.DataSource = DataSet1.Tables("tblNames")
ListBox1.DisplayMember = "LastName"

but i want to define 2 columns in the list box with specified widths, and
then load the 2 fields.

how would i do that IN CODE?

thanks,

ray
Jul 31 '07 #1
2 10464
Ray,

The Listbox control does not support multiple columns in the way that you
want to use them.

You could use a control that does support this type of multiple columns,
like a grid or listview.

Or you could create a "FullName" column in your datatable by combining
lastname, a comma, and firstname. Then use this "FullName" column as the
DisplayMember of the listbox.

Kerry Moorman
"ray well" wrote:
i need to display 2 columns of data in a list box.

how would i set this up IN CODE.

say my table is tblNames, and i have 2 fields, FirstName, LastName, and want
the data to show up in 2 columns, LastName, followed by FirstName

normally i would say

ListBox1.DataSource = DataSet1.Tables("tblNames")
ListBox1.DisplayMember = "LastName"

but i want to define 2 columns in the list box with specified widths, and
then load the 2 fields.

how would i do that IN CODE?

thanks,

ray
Jul 31 '07 #2
Ray,

You can create an extra column in your datatable which contains the
concatenated FirstName and the LastName or you can do it in your SQL querry.
Both are in my idea the most given answers for your question.

Cor

"ray well" <no****@nospam.comschreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
>i need to display 2 columns of data in a list box.

how would i set this up IN CODE.

say my table is tblNames, and i have 2 fields, FirstName, LastName, and
want the data to show up in 2 columns, LastName, followed by FirstName

normally i would say

ListBox1.DataSource = DataSet1.Tables("tblNames")
ListBox1.DisplayMember = "LastName"

but i want to define 2 columns in the list box with specified widths, and
then load the 2 fields.

how would i do that IN CODE?

thanks,

ray

Jul 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: carl.barrett | last post by:
Hi, I have a list box that displays 2 columns. Behind it sits a query with five columns. These are Column1 (DOB), column2 (a concatenated string of Surname Forname, Title), Column3 (Surname),...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
5
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
1
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control...
4
by: Brandon Potter | last post by:
I think I'm going crazy, but I cannot remember how to create a listbox with multiple columns as well as the sortable header block (a la Outlook message list). I've seen the examples of how to...
2
by: tangokilo | last post by:
Hello and thanks for your help, I have the following Listbox created in VisualStudio 2003 designer, desiring to select multiple entries from that list: -------------------------------...
3
by: David L Wright II | last post by:
I have a data bound listbox that I want to select multiple lines then process each line. I bound a two column datatable to the listbox and set the DisplayMember property to the appropriate column...
2
by: scratchadere | last post by:
I am tryin to partition a listbox into multiple columns.Here is the real problem.I am getting data from MS ACCESS database.I want to display it juz like how an email account displays unread messages...
6
by: =?Utf-8?B?SnVzdGlu?= | last post by:
Hello: Does anyone know how I can create a multi-column listbox in VB.Net (Windows)...I am using VS.Net 2003. If there is another control available that can be databound with multiple...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.