473,625 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView visible columns

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
Sep 6 '06 #1
3 4184
Hi Ryan,

If you need to hide a column in a certain DataSet, you can set the
DataColumn.Colu mnMapping property to MappingType.Hid den 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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====

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

Sep 7 '06 #2
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.

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.comwrote in message
news:0l******** *****@TK2MSFTNG XA01.phx.gbl...
Hi Ryan,

If you need to hide a column in a certain DataSet, you can set the
DataColumn.Colu mnMapping property to MappingType.Hid den 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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====

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

Sep 8 '06 #3
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.)

Sep 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
22115
by: Stropher | last post by:
I have the following: this.dataGridViewBill.DataSource = tblResult; //hide the following columns this.dataGridViewBill.Columns.Visible = false; //email this.dataGridViewBill.Columns.Visible = false; //mobiltelefon When I run the programm, the columns are still displayed. I am developing with Visual C#2005 Express Edition Beta.
0
1186
by: Crazy Cat | last post by:
In the following code I retrieve data from a stored procedure that returns multiple resultsets (the results of the stored procedure have been stored in a datareader called reader). On each iteration a tab page is added to a tab control and a datagridview is created on that the tab page. In the first iteration I can set all the values with no problems, however on the next iteration, even though there is definitely data in the data source,...
3
2871
by: Paul Cheetham | last post by:
Hi, I have a DataGridView control, and I am using it's datasource property to assign a datatable to it at runtime. The datatable has some columns in it that I don't want to be visible. With the DataGrid control in .Net 1, each Column had a property that allowed it to be bound to a column in a datatable, so I could define the columns of the grid, and which columns they related to in its datasource, and they were all that would display.
0
1942
by: bappelsin | last post by:
Hello, I have a problem with the datagridview. I have a view with around 25 different columns. To make life easier for the users I have implemented a popup dialog where the user can select which columns that should be displayed and in which order the columns are shown. After user has selected the visible columns and the order he presses ok. The grid is first cleared from rows, then I add all visible columns and then all hidden. Grid is...
0
2303
by: schoultzy | last post by:
Hello Everyone, I have been trying to figure this one out for two days now. I have created a DataGridView which is populated by an ObjectDataSource. My problem occurs when I attempt to use the Edit feature of the DataGridView. I have set several of the BoundField elements of the DataGridView to ReadOnly="True". When I attempt to use the Edit feature to UPDATE the rows in the DataGridView I get a System.NullReferenceException for...
0
1097
by: StanislavPetrov | last post by:
I have DataGridView with three columns.I set the columns AutoSizeMode to Fill.When i add rows to the datagridview at runtime i change their WrapMode property to False through RowDefaultCellStyle property of the datagridview.Set ScrollBars property to Both too.And when run the application and add rows,the bottom scrollbar is not visible if the AutoSizeMode property of the columns is set to Fill.For example if it is set to DisplayedCells it's...
1
3372
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons: 1) export to excel button exports the visible columns from the datagridview to excel (this works fine)
2
3912
by: TG | last post by:
Hi! This code works perfect except that it shows all the data from the datagridview. I only want to export the columns that are visible. How can I achieve this? Thanks a lot! Tammy
1
3774
by: =?Utf-8?B?VGFtbXk=?= | last post by:
Hi! I am using VB 2008 with SQL Server 2000 and SQL Server 2005 (depending which server the user selects to connect to). I have a combox in which the user types the server to connect to. Another combobox that shows the databases in that particular server. Another combobox with the filesets from the selected database above.
2
4629
by: TG | last post by:
Hi! I am trying to export only the visible columns from a datagridview in my windows form in VB 2008. Should't it be no comma after the first row where the headers are? Also should there be a comma at the last row?
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.