Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

datagridview Col 0 Visible = false, still shows up

49 views
Skip to first unread message

Greg P

unread,
Jul 28, 2006, 11:39:02 AM7/28/06
to
I have a tab control with many datagridview controls on it. I have an ID
column in column 0 on most of them. In the edit columns area I set the
columns visible property to false yet when I run the program it still shows
up. To fix this I can hide it if I do it programatiacally when the tab is
entered. Why doens't it work the first way?

Thanks,
Greg

Linda Liu [MSFT]

unread,
Jul 30, 2006, 10:55:34 PM7/30/06
to
Hi Greg,

I performed a test based on your description but I didn't reproduce the
problem you said.

Below is the steps of my test.

1. Set up a Windows application and drag&drop a TabControl onto the form.

2. Drag&drop a DataGridView onto the second tab page of the TabControl.

3. Create a DataSet and a DataTable in the project.

4. Add an instance of the DataSet I create into the form.

5. Set the DataSource of the DataGridView to the DataSet instance and the
DataMember of the DataGridView to the DataTable in the DataSet. Then VS
generates DataGridViewColumns in the DataGridView automatically.

6. Select the DataGridView in the designer, go to the Columns part and
click the button in Properties window to open Edit Columns window. Select
the first column in the Selected Columns list and set the Visible property
to false in the right pane. Press Ok button to close this window.

7. Compile this project and run the program.

When the program is running, the first column is invisible.

Are my above steps the same as yours? If not, could you tell me your steps
in detail? Or you may send me your sample project. To get my actual email
address, please remove the online from my displayed email address.

I look forward to your reply.


Sincerely,
Linda Liu
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.

Greg P

unread,
Aug 1, 2006, 6:50:02 PM8/1/06
to
Linda,

Sorry for the delay, got onto something else. Your recreation is very
similar yet not exact. I am using mulitiple dgv's on a tab control. I am
still seeing the behavior, never on the first tab though. I then see the
behavior on some of the other tabs (4 out of 6). I have found a work around
for this is to move the ID column down in the column list and the visible
property workds correctly. If I move the id column back to poition 0 it
reappears. This looks like a bug in the tab control - datagridview
relationship?

So to recreate, perform steps 1-3, but then add a tab control with at least
5 tabs on it. Then pull the datagridview off of datasource for 5 differnt
tables. Then make the first column of each dgv visible property = false.

Let me know if you see this also,

Thanks for your time,

Greg

Linda Liu [MSFT]

unread,
Aug 2, 2006, 5:52:39 AM8/2/06
to
Hi Greg,

Thank you for your update.

I performed a test base on your steps and did reproduce the problem. I have
set the Visible property of first column of each DataGridView to false.
When the program is running, only the DataGridView on the first tab page
hides its first column.

I add diagnostics statements both before and after the code of filling the
data source to see if the first column of the DataGridView on the second
tab page(i.e dataGridView2) is visible.

Below is my diagnostics statement.

using System.Diagnostics;

private void Form1_Load(object sender, EventArgs e)
{
Debug.WriteLine("before filling data source, the first column's
Visible is:" + this.dataGridView2.Columns[0].Visible.ToString());
// code of filling the data source
......
Debug.WriteLine("after filling data source, the first column's
Visible is:" + this.dataGridView2.Columns[0].Visible.ToString());

}

Press F5 to run the program and I see the below information in the Output
window.

before filling data source, the first column's Visible is:False
after filling data source, the first column's Visible is:True

We could see that the visible property of the first column of dataGridView2
has been changed after the data source is filled.

I think a workaround is to set the Visible property of the first column to
false after filling the data source. A sample code is below.

private void Form1_Load(object sender, EventArgs e)
{

// code of filling the data source
......
this.dataGridView2.Columns[0].Visible = false;
}

Hope this helps.
If you have anything unclear, please feel free to let me know.

Greg P

unread,
Aug 2, 2006, 1:49:54 PM8/2/06
to
Linda,

Glad you could reproduce. I have the two different work arounds to use but
is this not a bug? How can I report this to microsoft and track what action
is taken on it?

Thanks,
Greg

Linda Liu [MSFT]

unread,
Aug 3, 2006, 6:55:18 AM8/3/06
to
Hi Greg,

I have looked this problem in our inner database. However, I didn't find a
report of this problem in the database.

I recommend you to go to MSDN Product Feedback Center to make a bug report
on this issue. The following is the link:

http://lab.msdn.microsoft.com/productfeedback/default.aspx

Thanks for your support for Microsoft!

Greg P

unread,
Aug 3, 2006, 9:20:02 AM8/3/06
to
Linda,

I did report this as a bug, ID# 175584. It looks similar to a couple of
bugs I saw in the database. If you are interested I'm sure you know to add
yourself to the tracking.

Thank You for your time,

Greg P.

0 new messages