Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > hidden Columns in Datagridview
 

hidden Columns in Datagridview

I have hidden columns in a datagridview that is on a tab control (it's on the 3rd tab, so it's not initially displayed when I load my form). When I use the tabcontrol to display the datagridview prior to loading it with data it displays fine. If I navigate to it and then load it with data, that works fine as well. However, when I load it with data (while its not displayed and tab 31 is displayed instead) and then navigate to tab 3 to display the datagridview, the hidden column displays itself even though I've set the "visible" property in the designer to be "false".

Any suggestions?
MethodMas  Friday, August 28, 2009 3:50 PM
Hi,

I test on my side. Unfortunately, I am not able to reproduce this issue. I think I may miss something.

Could you please show us your code?

I use the following code. Run and select the third page. The first column is hided.

DataTable dt01 = new DataTable();

private void Form3_Load(object sender, EventArgs e)

{

// first dispaly page is the first page

tabControl1.SelectedIndex = 0;

DataGridView dataGridView01 = new DataGridView();

// add datagridview to the page 3

tabControl1.TabPages[2].Controls.Add(dataGridView01);

dt01.Columns.Add("col01");

dt01.Columns.Add("col02");

dt01.Columns.Add("col03");

dataGridView01.DataSource = dt01;

dataGridView01.Columns[0].Visible = false;

}

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Tuesday, September 01, 2009 1:01 PM

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, September 06, 2009 1:40 PM
This may have been some sort of odd bug with the designer because the problem went away.
MethodMas  Friday, October 02, 2009 4:35 AM

You can use google to search for other answers

Custom Search

More Threads

• Datagridview Validation Help
• backup,restore of sqlexpress 2005 database using vb 2005
• Databind custom collection to a combobox
• No DELETE is created
• RE: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
• How to do simultaneous insert into another table on insert in datagridview bound table
• how to display cursor in the datagrid cell
• Problems with a DataGridVew with a DataGridViewComboBoxColumn
• Related records don't link to parent table correctly
• Datagrid C# question.