How to display in a DataGrid only the columns of a dataSet that contain values?

Say I have a dataSet with 5 columns, denoted by ID_Code, Product_A, Product_B, Product_C, Product_D. Sometimes
the dataSet may only contain values for Product_A, Product_B, and Product_D (or other such combinations). There
will always be values for ID_Code. How do I set up my dataGrid to display only the columns containing values? For
this example, how do I make it appear as the following in my dataGrid? Bear in mind my next dataSet may contain
all the columns or perhaps any combination of Product columns.

ID_Code    PRoduct_A    Product_B    ProductD

Please provide code example. I am using VB.Net and Access database. Thank you for your assistance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
you would have to loop through your datasource.  If no value is found for all records for a given column then set the width of its related datagridcolumnstyle = 0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.