This is a migrated thread and some comments may be shown as answers.

Problem With Bound PictureBox Using Linq

0 Answers 27 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nima Nima
Top achievements
Rank 1
Nima Nima asked on 21 Sep 2009, 04:48 PM

Hi
I want to bind a picturebox Dynamically to an image field in database.
I use this code (I'm Using Northwind Database):

            using (DataClasses1DataContext dc=new DataClasses1DataContext())  
            {  
                var a = from p in dc.Products  
                        join c in dc.Categories  
                         on p.CategoryID equals c.CategoryID  
                        select new 
                        {  
                            ProductName=p.ProductName,  
                            UnitPrice=p.UnitPrice,  
                            UnitInStock=p.UnitsInStock,  
                            CatName=c.CategoryName,  
                            CatPic=c.Picture  
                        };  
                this.DataSource = a.ToList();  
            } 

And when I set Value of picturebox to "=Fields.CatPic" Nothing display.
How I can do that
Thanx

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Nima Nima
Top achievements
Rank 1
Share this question
or