Hi,
While using the DataGridView with BindingSource object I faced problem that during runtime the grid was showing the column for which I set the visible property False during designtime. I spent enough time to find out the reason of this unexpected behaviour. Ultimately, I observed that if I set the DataSource property of the BindingSource of the grid in the Form Load event, this problem occurs, but when I do this in the Form's constructor, it works fine and the hidden column remains hidden.
Anyone faced this problem??
What is the difference in setting the Binding Source of the DataGridView in Form Load and Form Constructor events??
Regards
NetDeveloper
You are right....Yes I am displaying the DataGridView inside a TabControl (3rd and 4th Tab).
For test purpose I moved a grid out of the TabControl, it worked as expected (the hidden columns remain hidden).
In your feedback you suggested to set the BindingSource in Form_Load, but my observation for the DataGridView is that if it is inside the TabControl and BindingSource is set in the Form_Load, it shows the hidden column. But if BindingSource is set in the Form's Constructor, it does not show the hidden columns.
Regards
NetDeveloper
netdeveloper:during runtime the grid was showing the column for which I set the visible property False during designtime
I've seen this too. Not sure if it applies in your case, but when I've seen it, it was always the first column in the grid (usually my PK) that I hide. I just rearrange the columns so the first column is a visible one.
Been a while, but I remember reading something about the grid automatically selects cell 0, 0, and in doing so, makes that column visible.
Copyright (c) Marimer LLC