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

  • Thread starter Thread starter Andreas Klemt
  • Start date Start date
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
 
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
 
Hello Natty,

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

Andreas
 
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
 
Back
Top