Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding Data to a List Box
Message
From
26/02/2008 15:05:12
Frank Dolinar
Mi House of Representatives
Michigan, United States
 
 
To
26/02/2008 12:41:59
Timothy Bryan
Sharpline Consultants
Conroe, Texas, 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:
01296559
Views:
11
Tim,

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()

This gives me an error at the line where the binding source is assigned because dvReportCat is a view and can't be converted to a string, which the bindingSource property expects. Does the same thing if I use dtReportCat.

If I remove the BindingSource line, I don't get an immediate error, but every line in the list box shows the same thing, specifically:
System.Data.DataRowView

I don't know what we're doing wrong. I be happy if we've just been stupid and have missed something obvious.

Any further clues?

Thanks,
Frank
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform