DataGridView visible columns

R

Ryan

I've had troubles with my DataGridView objects in that it is often difficult
to make columns such as key columns invisible. These DataGridViews always
have a datasource of an external SQL database. Setting the columns Visible
property to False does not always work. After fiddling around with it for
hours I've gotten others to work but still haven't figured out the source of
the problem. Anyone else had problems with this and any known workarounds?

Thanks,
Ryan
 
K

Kevin Yu [MSFT]

Hi Ryan,

If you need to hide a column in a certain DataSet, you can set the
DataColumn.ColumnMapping property to MappingType.Hidden directly. Setting
this in the data source, you needn't care about which column it is actually
displayed in the DataGridView, which makes it simpler.

HTH.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
R

Ryan

I looked through my dataset in the Designer and did not see this property
anywhere. All I had to do to fix it though is move the key column down in
the DataGridView so it was not the first column displayed. Very odd.
 
K

Kevin Yu [MSFT]

Hi Ryan,

This property is not in the designer, you have to do this in your code.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top