Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Data to a List Box
Message
 
À
26/02/2008 15:05:12
Frank Dolinar
Mi House of Representatives
Michigan, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Divers
Thread ID:
01294437
Message ID:
01298016
Vues:
19
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform