473,509 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding array to a listbox error

Hello all,

Framework 1.1 VS 2003 Binding listbox.

I have an array of objects that I am trying to use as the datasource
for a listbox. The array is returned from a webservice and seems to be
populated ok, see this text from my Autos pane in VS, once the
datasource property has been set.

- DataSource {System.Array} System.Object
- [0] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
System.Object {RiskReport.TLDManager.Country} System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDManager.TLD[]
+ [1] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [2] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [3] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [4] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [5] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [6] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [7] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [8] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
As you can see (I've opened the first array item) each Country object
contains 3 properties (CountryID,Name and TLDs) and I am trying to set
the text field to name and the value to CountryID:-

this.lbCountries.DataSource = api.GetCountries();
this.lbCountries.DataTextField = "Name";
this.lbCountries.DataValueField = "CountryID";
this.lbCountries.DataBind();
However on binding I get the error 'RiskReport.TLDManager.Country' does
not contain a property with the name Name. It is spelt correctly and
there are no leading or trailing spaces, this also applies to the
CountryID if I comment out the line to set the DataTextField.

Any help appreciated.

Paul

Jul 17 '06 #1
1 1493
apologies for the re-post, please see thread labbelled "Listbox
Databinding to array of simple objects fails "

thanks

Paul

pa****@gmail.com wrote:
Hello all,

Framework 1.1 VS 2003 Binding listbox.

I have an array of objects that I am trying to use as the datasource
for a listbox. The array is returned from a webservice and seems to be
populated ok, see this text from my Autos pane in VS, once the
datasource property has been set.

- DataSource {System.Array} System.Object
- [0] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
System.Object {RiskReport.TLDManager.Country} System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDManager.TLD[]
+ [1] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [2] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [3] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [4] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [5] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [6] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [7] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [8] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
As you can see (I've opened the first array item) each Country object
contains 3 properties (CountryID,Name and TLDs) and I am trying to set
the text field to name and the value to CountryID:-

this.lbCountries.DataSource = api.GetCountries();
this.lbCountries.DataTextField = "Name";
this.lbCountries.DataValueField = "CountryID";
this.lbCountries.DataBind();
However on binding I get the error 'RiskReport.TLDManager.Country' does
not contain a property with the name Name. It is spelt correctly and
there are no leading or trailing spaces, this also applies to the
CountryID if I comment out the line to set the DataTextField.

Any help appreciated.

Paul
Jul 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3070
by: ShadowsOfTheBeast | last post by:
hi all i am trying to bind data to my datagrid from a listbox which i think it should work but an error is coming up saying i have to bind to a datasource that implements the Inumerable or...
1
5300
by: Sachin Kuchinad | last post by:
Hi All I am using .NET Framework version 1.0.3705 to build a website. Now i have made a webform and on that i have added a dropdown to the page I bind this listbox to a datareader . This does...
1
1640
by: amber | last post by:
Hello I'm trying to run the code below, but I'm running into a problem It is populating a listbox, based on whether or not the user enters data into a text box. If they enter something, it returns...
3
8877
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C...
4
23406
by: Jim Shaffer | last post by:
Perhaps I have the wrong construct, or misunderstand arrays in vb (2003).... I've loaded a two-dimensional array (168 by 28) into memory as AcctArray. {Dim AcctArray (500,28) as string...} The...
1
2756
by: A. Spiehler | last post by:
I'm trying to fill a listBox control with string members from an array of objects. I think using data binding is supposed to be the easiest way to do this. I've never used data binding before and...
0
1826
by: EricLondaits | last post by:
Hi, I have an ASP.NET page with a ListBox that is data bound to a table with a single field (it holds a list of valid IDs). The page also has a textBox into which you can add new valid IDs, one...
1
2279
by: csharpula csharp | last post by:
Hello, I have the following situation: A BindingList (which is binding between list of object and ListBox) of items. I choose few items from the list -press a button and want that the items that...
0
2539
by: furqanms | last post by:
Hello, I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference. Here is my code : <UserControl x:Class="uctlBrowser" ...
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7136
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.