Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding Data to a List Box
Message
 
To
26/02/2008 15:05:12
Frank Dolinar
Mi House of Representatives
Michigan, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Miscellaneous
Thread ID:
01294437
Message ID:
01298016
Views:
20
This message has been marked as the solution to the initial question of the thread.
Frank,

> At the beginning of this particular form's code, at the top of the class, I've included the following lines:
>
> Public oReportCat as New Bus.ReportCatalog
> Public dtReportCat as DataTable = oReportCat.GetAllData()
> Public dvReportCat as DataView = me.dtReportCat.DefaultView
>
>...so, yes, dtReportCat is a DataTable
>
> The workaround in the form load method didn't intentionally avoid using the mmListBox properties. We're pretty new to MM.Net here and I apparently grabbed the first thing out of IntelliSense that made some sense. It also worked, by the way.
>
> Having received your last note, I went back and tried the following code in the form's load method:
> me.dtReportCat = oReportCat.GetAllData()
> me.lstReportCat.BindingSource = me.dvReportCat
> me.lstReportCat.BindingSourceDisplayMember = "strReportName"
> me.lstReportCat.BindingSourceValueMember = "strReportFile"
> me.lstReportCat.Enabled = True
> me.optAllReports.Select()
>

Check out the MM .NET Dev Guide topic "Data Binding Windows Forms List Controls". There you will find instructions for binding to a DataView. You want to do something like this (where you replace "TableName" and "ViewName" with the real table and view names):
me.lstReportCat.BindingSource = "ReportCatalog"
me.lstReportCat.BindingSourceDisplayMember = "TableName.ViewName.strReportName"
me.lstReportCat.BindingSourceValueMember   = "TableName.ViewName.strReportFile"
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform