Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 March 14th, 2005, 05:32 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help for newbie filling listbox

I’m trying to populate a listbox with data that comes from my SQL server. I’ve created the connection, filled the dataset and loaded the data adapter. Apparently, I’m missing something because after this runs, what is populated in the listbox is: “System.Data.DataRowView” for each record in my data adapter.

When I click on one of the rows (which really doesn’t make sense) as I test the rest of my routine, I’m able to trick it into showing me other data from that row.

Below is the piece of code that I'm trying to use to load my listbox.

'Fill the data adapter
daEmployeeTree.Fill(dsEmployeeTree, "SuperInfo")

' create data view
Dim dv As DataView = dsEmployeeTree.Tables("SuperInfo").DefaultView
lbxEmployee.DataSource = dv
lbxEmployee.DisplayMember = "SuperInfo"
lbxEmployee.DisplayMember = dv.ToString

Can someone help me fill my listbox with meaningful data? As you can tell, I’m new to this so any and all help is greatly appreciated.

Thanks,

 
Old March 19th, 2005, 04:36 PM
Authorized User
 
Join Date: Jul 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Mayur52o
Default

Try not to user dv.ToString and Assign a ColumnName to Display Member





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
Challenge Filling listbox from codebehind Snuffles ASP.NET 2.0 Basics 2 April 28th, 2007 02:25 PM
filling the screen darkhalf CSS Cascading Style Sheets 0 September 26th, 2006 02:29 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.