• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

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.
0
IT_Steve
Asked:
IT_Steve
1 Solution
 
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now