473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error : Complex DataBinding accepts as a data source either an IList or an IListSource

BS
Hello everybody

I'm calling a webservice that returns complex data.
The goal is to populate a datagrid with it.

Using a loop for each record found ( such as For i = 0 To
oResponse.historicalData.Length - 1 )
no problem to load a datagrid.

However, when I try to bind directly the datasource to the web service
complex datatype, I have the following error:
Complex DataBinding accepts as a data source either an IList or an
IListSource

Any idea what I have to do to the webservice records in order for my
datagrid to load ?
Here is the code used to pupulate the grid.

Dim oES As SomeWebservice.EquipmentService = New
SomeWebservice.EquipmentService
Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData
'set response object with service response
oResponse = oES.historicalData(oRequest)

DataGrid1.DataSource = oResponse

Nov 20 '05 #1
7 11885
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello everybody

I'm calling a webservice that returns complex data.
The goal is to populate a datagrid with it.

Using a loop for each record found ( such as For i = 0 To
oResponse.historicalData.Length - 1 )
no problem to load a datagrid.

However, when I try to bind directly the datasource to the web service
complex datatype, I have the following error:
Complex DataBinding accepts as a data source either an IList or an
IListSource

Any idea what I have to do to the webservice records in order for my
datagrid to load ?
Here is the code used to pupulate the grid.

Dim oES As SomeWebservice.EquipmentService = New
SomeWebservice.EquipmentService
Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData
'set response object with service response
oResponse = oES.historicalData(oRequest)

DataGrid1.DataSource = oResponse

Nov 20 '05 #2
BS
Hello
I posted a "short" version of the definition on the "webservice" newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello everybody

I'm calling a webservice that returns complex data.
The goal is to populate a datagrid with it.

Using a loop for each record found ( such as For i = 0 To
oResponse.historicalData.Length - 1 )
no problem to load a datagrid.

However, when I try to bind directly the datasource to the web service
complex datatype, I have the following error:
Complex DataBinding accepts as a data source either an IList or an
IListSource

Any idea what I have to do to the webservice records in order for my
datagrid to load ?
Here is the code used to pupulate the grid.

Dim oES As SomeWebservice.EquipmentService = New
SomeWebservice.EquipmentService
Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData
'set response object with service response
oResponse = oES.historicalData(oRequest)

DataGrid1.DataSource = oResponse


Nov 20 '05 #3
Hi,

What is the format of this. I need to know more about
responseHistoricalData

Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData

Ken
--------------
"BS" <lb*@nospam.com> wrote in message
news:O9**************@TK2MSFTNGP09.phx.gbl...
Hello
I posted a "short" version of the definition on the "webservice"
newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will
be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Hello everybody
>
> I'm calling a webservice that returns complex data.
> The goal is to populate a datagrid with it.
>
> Using a loop for each record found ( such as For i = 0 To
> oResponse.historicalData.Length - 1 )
> no problem to load a datagrid.
>
> However, when I try to bind directly the datasource to the web service
> complex datatype, I have the following error:
> Complex DataBinding accepts as a data source either an IList or an
> IListSource
>
> Any idea what I have to do to the webservice records in order for my
> datagrid to load ?
>
>
> Here is the code used to pupulate the grid.
>
> Dim oES As SomeWebservice.EquipmentService = New
> SomeWebservice.EquipmentService
> Dim oResponse As SomeWebservice.responseHistoricalData = New
> SomeWebservice.responseHistoricalData
>
>
> 'set response object with service response
> oResponse = oES.historicalData(oRequest)
>
> DataGrid1.DataSource = oResponse
>
>
>



Nov 20 '05 #4
BS
Here is the definitions: They are most of the time "complex data type".

----------------------------------------------------------------------------
---------------------------------------------------------
'<remarks/>

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX.c
om/integration/2.0")> _

Public Class responseHistoricalData

Inherits LegacyApiOutput
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute("his toricalData")> _

Public historicalData() As historicalData

End Class
----------------------------------------------------------------------------
---------------------------------------------------------

'<remarks/>

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX.c
om/integration/2.0")> _

Public Class historicalData
'<remarks/>

Public equipmentID As String
'<remarks/>

Public terminalID As String
'<remarks/>

Public arrivalTimestamp As String
'<remarks/>

Public position As positionAndProximityWithTimestamp
'<remarks/>

Public serviceMeterHours As serviceMeterHoursWithTimestamp

End Class

----------------------------------------------------------------------------
---------------------------------------------------------

'<remarks/>

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX..
com/integration/2.0")> _

Public Class positionAndProximityWithTimestamp

Inherits positionWithTimestamp
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute("pro ximity")> _

Public proximity() As proximity

End Class

----------------------------------------------------------------------------
---------------------------------------------------------

'<remarks/>

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX..
com/integration/2.0")> _

Public Class proximity
'<remarks/>

Public type As proximityType
'<remarks/>

Public location As String
'<remarks/>

Public [region] As String
'<remarks/>

Public postalCode As String
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute("kil ometersFromLocation",
GetType(System.Decimal)), _

System.Xml.Serialization.XmlElementAttribute("mile sFromLocation",
GetType(System.Decimal)), _

System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")> _

Public Item As Decimal
'<remarks/>

<System.Xml.Serialization.XmlIgnoreAttribute()> _

Public ItemElementName As ItemChoiceType1
'<remarks/>

Public directionFromLocation As proximityDirection

End Class

----------------------------------------------------------------------------
---------------------------------------------------------



"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
Hi,

What is the format of this. I need to know more about
responseHistoricalData

Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData

Ken
--------------
"BS" <lb*@nospam.com> wrote in message
news:O9**************@TK2MSFTNGP09.phx.gbl...
Hello
I posted a "short" version of the definition on the "webservice"
newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will
be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Hello everybody
>
> I'm calling a webservice that returns complex data.
> The goal is to populate a datagrid with it.
>
> Using a loop for each record found ( such as For i = 0 To
> oResponse.historicalData.Length - 1 )
> no problem to load a datagrid.
>
> However, when I try to bind directly the datasource to the web service > complex datatype, I have the following error:
> Complex DataBinding accepts as a data source either an IList or an
> IListSource
>
> Any idea what I have to do to the webservice records in order for my
> datagrid to load ?
>
>
> Here is the code used to pupulate the grid.
>
> Dim oES As SomeWebservice.EquipmentService = New
> SomeWebservice.EquipmentService
> Dim oResponse As SomeWebservice.responseHistoricalData = New
> SomeWebservice.responseHistoricalData
>
>
> 'set response object with service response
> oResponse = oES.historicalData(oRequest)
>
> DataGrid1.DataSource = oResponse
>
>
>



Nov 20 '05 #5
Hi,
First off if you can only bind to properties in a class class
not public variables.

For example change
Public equipmentID As String

To
Private mstr_equipmentId As String

Public Property equipmentID() As String
Get
Return mstr_equipmentId
End Get
Set(ByVal Value As String)
mstr_equipmentId = Value
End Set
End Property

Second Try loading the data into an arraylist and bind to that.

oResponse = oES.historicalData(oRequest)
dim arBindto as new ArrayList
arBindto.Add(oResponse)
DataGrid1.DataSource = arBindto

Hope that helps.

Ken
-------------------
Nov 20 '05 #6
BS
Thank you Ken,

yes I already tried your suggestion of creating a "buffer" class for each
webservices functions called.
It works very well.

But that method did not seems efficient to me...add a new layer in between
the 2.Also, I should maybe mention that we do not have control to the web
service definitions...we did not write it. I have to use it as is.

But if that is the only solution...

Thank you very much for your help !
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi,
First off if you can only bind to properties in a class class
not public variables.

For example change
Public equipmentID As String

To
Private mstr_equipmentId As String

Public Property equipmentID() As String
Get
Return mstr_equipmentId
End Get
Set(ByVal Value As String)
mstr_equipmentId = Value
End Set
End Property

Second Try loading the data into an arraylist and bind to that.

oResponse = oES.historicalData(oRequest)
dim arBindto as new ArrayList
arBindto.Add(oResponse)
DataGrid1.DataSource = arBindto

Hope that helps.

Ken
-------------------

Nov 20 '05 #7
HI BS,

In my opinion is the solution Ken advises you is not inefficient however
very sufficient.

Cor
Nov 20 '05 #8

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

Similar topics

0
by: CGuy | last post by:
URGENT HELP REQUIRED FROM GURUS Hi, I have a custom object that implements ICollection and IListSource. This object has also an enumerator defined for it which implements IEnumerator and...
5
by: K | last post by:
I created a collection which is derived from ArrayList and implements IBindingList and ITypedList. Then I bound the DataSource of a data grid into the collection. It could show up the data but...
1
by: Ananth | last post by:
Hi, I have a question regarding data grids My application requires me to use a grid for displaying data, however I would not be using a database for procuring the data, instead I would be...
0
by: TEK | last post by:
Hello Can anyone lead me in the correct direction for how to support databinding on a custom control. I need to support the DataSource and DataMember property. (I have kindof nailed down the...
3
by: Tom McLaughlin | last post by:
I am new to vb.net and I am running into problems understanding DataBinding and its concept. The only examples I find are always talk about Web design, I only want to use this data on my...
13
by: Michael Maes | last post by:
Hi, I have a UserControl containing some controls of which one is a ComboBox. All the InternalControls are Private and some are allowed to be accessed through Public Methods. One of the things I...
2
by: ECathell | last post by:
'------------------------------------------------------------------------------------------------ 'Label Formats...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
2
by: =?Utf-8?B?UGFvbG8=?= | last post by:
I am trying to populate a Listbox with the results of a query triggered from a selection in a combo box: private void cmbxCategory_SelectedValueChanged(object sender, EventArgs e) { string...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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...

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.