HowTo Bind a New Collection to my DataGrid? Please take a look to my little code...Thanks!!

A

Andreas Klemt

Hello,
I have this

Public Structure strucUser
Dim userIDAs Integer
Dim firstnameAs String
Dim lastname As String
End Structure

Dim collectUser As New Collection
Dim strucUser As strucUser
strucUser .userIDAs = rateID
strucUser .firstnameAs = "Peter"
strucUser .lastname = "Bond"
collectUser .Add(strucUser )

myDatagrid.DataSource = collectRate <<<---- ERROR !!!
myDatagrid.DataBind()


Error Message:
DataGrid with id '' could not automatically generate any columns from the
selected data source

What is wrong?

Thanks for any help,
Andreas
 
N

Natty Gur

Hi,

1) where collectRate come from ?
2)

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 
A

Andreas Klemt

Hello Natty,

sorry, this was collectUser
But it still doesn't work.
Can you help me?

Andreas
 
N

Natty Gur

OK,

"Use the DataSource property to specify the source of values to bind to
a data listing control. The data source must be an object that
implements the System.Collections.IEnumerable interface (such as
System.Data.DataView, System.Collections.ArrayList, and
System.Collections.Hashtable) to bind to a control derived from the
BaseDataList class." - MSDN

VB collection dosent Implement one of them. consider using one of the
system.collection classes.



Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top