Question Databinding Controls to Lists

mclark1129

New member
Joined
Apr 3, 2009
Messages
3
Programming Experience
1-3
Hello,

I am writing a VB.net Forms application for the first time and I am having trouble databinding controls to a non-SQL datasource, such as a list. Basically I have a function that returns a List(Of Product) where Product is a custom class I have written. The product's fields are contained in the Details property of the class, so I would be accessing my fields using this syntax:

myProduct.Details.ID, myProduct.Details.Name, etc.

When I look around for tutorials or examples, they are almost entirely examples that use the VS Datasource Wizard or something along those lines where all I need to do is just run a wizard, drag some .xsd file on to the page and VOILA! Personally, I prefer to hand code where possible and am generally pretty leery of any visual coding tools, but even so I can't even figure out how I would be able to use these datasource tools to use my list data. I've even tried using an Object datasource with my Product class in the Forms designer. It *works* to the extent that my datarepeater shows a datagrid view (identical to the one in Microsoft Access) with the columns I dragged over in it. SUCCESS! Except... now how do I populate it with a list of those objects?

In the form Load event I try using

myDataRepeater.Datasource = Product.GetAllProducts() 'Returns List(Of Product)

but when I run the program the datarepeater is empty. Any advice you can give me on this subject is greatly appreciated.

Thanks!

Mike C
 
Top Bottom