473,598 Members | 3,252 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.TLD Manager.Country } RiskReport.TLDM anager.Country
System.Object {RiskReport.TLD Manager.Country } System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDM anager.TLD[]
+ [1] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [2] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [3] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [4] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [5] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [6] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [7] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [8] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.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.lbCountrie s.DataSource = api.GetCountrie s();
this.lbCountrie s.DataTextField = "Name";
this.lbCountrie s.DataValueFiel d = "CountryID" ;
this.lbCountrie s.DataBind();
However on binding I get the error 'RiskReport.TLD Manager.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 1505
apologies for the re-post, please see thread labbelled "Listbox
Databinding to array of simple objects fails "

thanks

Paul

pa****@gmail.co m 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.TLD Manager.Country } RiskReport.TLDM anager.Country
System.Object {RiskReport.TLD Manager.Country } System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDM anager.TLD[]
+ [1] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [2] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [3] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [4] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [5] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [6] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [7] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.Country
+ [8] {RiskReport.TLD Manager.Country } RiskReport.TLDM anager.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.lbCountrie s.DataSource = api.GetCountrie s();
this.lbCountrie s.DataTextField = "Name";
this.lbCountrie s.DataValueFiel d = "CountryID" ;
this.lbCountrie s.DataBind();
However on binding I get the error 'RiskReport.TLD Manager.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
3084
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 icollection...but i thought list boxes did implement one of the above as they do have their items collection property, can anyone help?
1
5309
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 not happenm , i have no clue what the problem is I am attaching the error <font color='red' >
1
1649
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 only that record, if they leave it blank, it returns all records. This works fine. Now I have text boxes that are linked to what is displayed in the listbox. If the user enters nothing, it works fine, and if the user enters something it works fine,...
3
8888
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 Me.ListBoxPerson.Items.AddRange(ary)
4
23419
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 AcctArray is loaded from a Quickbooks table, so there's no intrinsic dataset to assign as datasource.... I want to have a combo table (or list table or whatever), currently named cbAccounts, that can scroll through and maybe select items in the...
1
2768
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 am having trouble getting it to do anything. The relevant code is below, followed by a better explanation of what I'm trying to do. // pseudocode start public delegate string StepMethod();
0
1840
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 per line (this is in order to make the process of adding new IDs easy, since it's only done at time of configuration). I have no problem with retrieving the contents of the textBox, splitting it into a string array, validating the individual...
1
2285
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 been choosen will be transformed to other list and will be delited from the original ListBox.My problem is that this action also deletes items from the objects list. How can I juust copy to binding list and see the change in ListBox only? Thank...
0
2546
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" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"> <Grid Width="Auto" Height="Auto">
0
7899
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8397
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8264
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6718
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3897
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1250
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.