Hi All,
I recently uninstalled VS2005 BETA 1 and installed VS2005 beta 2. The new beta 2 seems a little more stable, but I ran into the following problems:
1.) I have a base user control "A", which contains a datagridview. This user control is inherited by user control "B". With beta 1, I can visually add, edit, remove any column in the datagridview using VS2005 IDE designer. With beta 2, I can't no longer edit the columns interactively using the designer. Beta 2 only allows us to edit the column on the base level.
2.) With beta 1, I set the AutoGenerateColumn to false, when my code bind the datagridview data source to the dataset, records are automatically loaded into the datagridview, to the predefined columns that I defined. After upgrade to beta 2, this is no longer happened. On my testing, the dataset contains 3 records. The datagridview, after the data source is binded, it creates 3 empty rows on the datagridview, but none of the columns are populated with data from the records. Curiously, I set the AutoGenerateColumns to TRUE, and yet, the datagridview is populated with data. But that is not what I want. I don't want the column to be autogenerated.
My really concern now is the problem #2. Is this a bug Or do I have to do something extra in my code in Beta 2 in order for the columns to be populated with data from the data set
Thanks in advance.
David N

DataGridView Problem
chuckcycles
// original populated list
List<Decimal>^ frequencies = gcnew List();
frequencies->Add( Decimal(1.0) );
frequencies->Add( Decimal(2.0) );
BindingList^ bl = gcnew BindingList<Decimal>( frequencies );
BindingSource^ bs = gcnew BindingSource();
bs->DataSource = bl;
frequencyGridView->DataSource = bs;
When the grid appears it has two blank rows. If I change the number of values in the original list all that happens is I see more or less blanks rows. I never see the data in the cells although if I debug I can see that values are there.
It would be nice to get a fix to this soon.
Michael
Chelten
Thanks for replying.
I did always have the .AutoGenerateColumns set to false immediately before the datasource binding, and in my source code, there is no other places where the datasource binding is called.
But it still does not work.
I traced the source code and have two break points: one in the rowsadded() event and one in the CellValidating() event. It appears to me that immediatly after the datasource binding occurs, the dataset is read into the datagridview (I have three records in the dataset, and the events were called three time each). Within the two events code block, I can even see some data loaded in the cell. But yet, the data is not displayed on the datagridview, only the headers are displayed with empty cells.
DQ
Tyagi
I create another Windows program. This program has nothing but a form with a DataGridView which has pre-defined columns created using the VS IDE designer.
And I was unable to get the datagrid populated. Again, if I set the AutoGenerateColumns to true, and then the grid is populated with data records. Of-course the auto generated columns are appended following the predefined columns, even though the predefined set has exactly the same column names as the auto generated does.
Can someone confirm that this is a bug
Thanks
DQ
BBVB
what do you mean exactly by "you'll have to use code to achieve this"
Thanks
multisession
Regarding #2 - This is a behavior change that is subtle -- We now default AutoGenerateColums to true unless you databind the DataGridView at design time. So, you need to change your code to set AutoGenerateColumns to false before you set the datasource:
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = bindingSource1;
Hope this helps!
-mark
Program Manager
This post is provided "as-is"
Ghawas
When I select an item in a combo box and the search button the first time, the code, "AutoGenerateColumn = false", it works. When I select another item from a combo box and hit the search button, the code is traced and executes the "AutoGenerateColumn = false" statement but when displaying the new datagridview with the new item, the datagridview seems to revert back to the default.
I have written the code exactly how Mark Rideout (Microsoft) suggests.
This is definately a bug in the framework.
BenLovesSQL
We hope to enable this in future versions. Until then, you'll have to use code to achieve this.
Thanks,
-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
Mark Essien
Hopefully, MS folks don't give up on this problem...
How about everyone else Do you run into the same problem with DataGridView like I do Either a) noone is working on the DataGridView, b) noone has the problem that I have, which means I did something wrong, or c) you guys did run into the same problem, but are watching this thread with the same hope that we are going to get some good response from our friends at MS.
I really need to solve this problem, because it stops my development.
Can you please hep, MS
Thanks.
SGK
Hi,
As I mentioned it's a designer restriction, the nature of inheritance is not affected by this problem. You can use code in the constructor of your derived form to modify the properties of the inherited DataGridView. The compiler will do its best. But unfortunately the modification process is apparently more difficult since you can't see the result at design time; you'll have to build and run your project to see the results at run time.
Anyway thank you Mark for your reply.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
pcsql
David - Where do you add your columns to the DataGridView and when do you set the column's DataPropertyName value
-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
Christian Burgener
Hi,
I have a similar problem, it's even worse. I can't change any property of the DataGridView in the inherited form. The access modifier for the DataGridView is protected, I even set it to public, but the designer treats it as private and all the properties are readonly. I didn't have this problem in Beta 1.
Can anyone help is there any solution other than to wait for the final version < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />