Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2004, 12:01 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default MultiColumn ListBox

Hello-

I have a Listbox that I am attempting to fill from a database. I have set up my DataAdapter and Dataset to load the displaymember and valuemember for each row. The problem is, I want two values from my dataset to be displayed in seperate columns (or the same column...I don't care as long as they are both displayed). Can you please help? Thanks!

 
Old February 9th, 2004, 12:48 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A listbox only has one displayed value. If you want more than 1 value, then you will have to modify your query to select more than one value into a single column result and then use that column as your display member.

Example:

SELECT UserName, LastName+', '+FirstName AS FullName FROM Users ORDER BY LastName, FirstName

Then you use "UserName" as your valuemember, and "FullName" as your displaymember.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old February 9th, 2004, 06:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Note that the .NET listbox does support the UseTabStops property which allows you, after a fashion, to simulate multiple columns by inserting an appropriate number of tab characters in the strings you add to the listbox.

It's not very satisfying, but it does sort of work...

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old February 24th, 2006, 07:17 PM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rbgamer
Default

I have come with this conclusion myself, However, is there a way to create a componant that can be writen to give an account of fields and columns?

Is there any expample code that can help aide in this delema.

thank you.

rb

 
Old February 24th, 2006, 10:49 PM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rbgamer
Default

I have found on C++ and you create an ActiveX Control, if you right click on the form, you can insert an ActiveX control called Microsoft Forms 2.0 Listbox. This can be found in the FM20.dll. When I inserted this object, I found that this is the component that we are looking for. However when I goto the VB environment, I find it under Microsoft Forms 2.0 Object Library. If you the goto Tools/Choose Toolbox item. When the window opens, you can scrool down and find the component. I added the component and could not find the the datasource and datafield properties. I also tried to compile and I got errors. I was also wanted to try to recreate this but an ActiveX designer included in the Enterprise Edition of Visual Basic, and I have the professional version.

This is my 2 cents.







Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox obrienkev C# 2005 4 November 6th, 2007 03:15 AM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
MultiColumn ComboBox from ComboBoxEditingControl HemaChaudhry Visual Basic 2005 Basics 0 January 10th, 2006 05:51 AM
Multicolumn Combo nazran VB How-To 1 March 11th, 2004 07:51 PM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.