dotnet windows forms:
Does anyone know why this is not exposed in the designer? Is it just me or is this a really stupid oversight? I turn it on in code, but that doesn't prevent the designer from every once in a while autogenerating columns on my datagridview. I can't seem to predict when this'll happen -- for example, I've got my datagridview's datasource set to a bindingsource -- I clear out the unnecessary colums in the datagridview and start the application. All is fine. However, on subsequent restarts, sometime I'll see that columns have been autogenerated in the designer, even though in the particular edit session, I never changed the datasource, or any aspects of the bindingsource. How to stop this -- it is ANNOYING!
On Wed, 30 Jan 2008 08:37:59 -0800 (PST), Crazy Cat [quoted text, click to view] <danbredy@hotmail.com> wrote: >Does anyone know why this is not exposed in the designer? > >Is it just me or is this a really stupid oversight? > >I turn it on in code, but that doesn't prevent the designer from every >once in a while autogenerating columns on my datagridview. I can't >seem to predict when this'll happen -- for example, I've got my >datagridview's datasource set to a bindingsource -- I clear out the >unnecessary colums in the datagridview and start the application. All >is fine. However, on subsequent restarts, sometime I'll see that >columns have been autogenerated in the designer, even though in the >particular edit session, I never changed the datasource, or any >aspects of the bindingsource. > >How to stop this -- it is ANNOYING!
I have run into the same problem. I asked about this here a few months ago but never received a response. What I finally did was to create a subclass of DataGridView and set
[quoted text, click to view] On Jan 30, 1:40 pm, Jack Jackson <jjack...@cinnovations.net> wrote: > On Wed, 30 Jan 2008 08:37:59 -0800 (PST), Crazy Cat > > > > <danbr...@hotmail.com> wrote: > >Does anyone know why this is not exposed in the designer? > > >Is it just me or is this a really stupid oversight? > > >I turn it on in code, but that doesn't prevent the designer from every > >once in a while autogenerating columns on my datagridview. I can't > >seem to predict when this'll happen -- for example, I've got my > >datagridview's datasource set to a bindingsource -- I clear out the > >unnecessary colums in the datagridview and start the application. All > >is fine. However, on subsequent restarts, sometime I'll see that > >columns have been autogenerated in the designer, even though in the > >particular edit session, I never changed the datasource, or any > >aspects of the bindingsource. > > >How to stop this -- it is ANNOYING! > > I have run into the same problem. I asked about this here a few > months ago but never received a response. > > What I finally did was to create a subclass of DataGridView and set > AutoGenerateColumns = False in the constructor.
Thanks for your response Jack. I tried this and yet it is still autogenerating the columns. It must be something I'm doing. I looked at my code and the only thing I can put it down to is that I dynamically set the datasource in the code, but I set autogeneratecolumns to false in the constructor of the derived class and for good measure in the grid. In design view I deleted the extraneous columns, started the application and all was good. As soon as I stopped debugging I notice that magically the columns have been regenerated in design mode.
[quoted text, click to view] On Jan 30, 3:03 pm, Crazy Cat <danbr...@hotmail.com> wrote: > On Jan 30, 1:40 pm, Jack Jackson <jjack...@cinnovations.net> wrote: > > > > > On Wed, 30 Jan 2008 08:37:59 -0800 (PST), Crazy Cat > > > <danbr...@hotmail.com> wrote: > > >Does anyone know why this is not exposed in the designer? > > > >Is it just me or is this a really stupid oversight? > > > >I turn it on in code, but that doesn't prevent the designer from every > > >once in a while autogenerating columns on my datagridview. I can't > > >seem to predict when this'll happen -- for example, I've got my > > >datagridview's datasource set to a bindingsource -- I clear out the > > >unnecessary colums in the datagridview and start the application. All > > >is fine. However, on subsequent restarts, sometime I'll see that > > >columns have been autogenerated in the designer, even though in the > > >particular edit session, I never changed the datasource, or any > > >aspects of the bindingsource. > > > >How to stop this -- it is ANNOYING! > > > I have run into the same problem. I asked about this here a few > > months ago but never received a response. > > > What I finally did was to create a subclass of DataGridView and set > > AutoGenerateColumns = False in the constructor. > > Thanks for your response Jack. > > I tried this and yet it is still autogenerating the columns. It must > be something I'm doing. > > I looked at my code and the only thing I can put it down to is that I > dynamically set the datasource > in the code, but I set autogeneratecolumns to false in the constructor > of the derived class and for > good measure in the grid. In design view I deleted the extraneous > columns, started the application > and all was good. As soon as I stopped debugging I notice that > magically the columns have been regenerated > in design mode.
OK, this time I'm pretty sure it's nothing I'm doing. In design mode I delete the extraneous columns. When I close the form and reopen it in the designer the columns have been autogenerated. This is only happening on one datagrid in my application. WHAT THE HELL? Sign me, FRUSTRATED
[quoted text, click to view] On Jan 30, 3:11 pm, Crazy Cat <danbr...@hotmail.com> wrote: > On Jan 30, 3:03 pm, Crazy Cat <danbr...@hotmail.com> wrote: > > > > > On Jan 30, 1:40 pm, Jack Jackson <jjack...@cinnovations.net> wrote: > > > > On Wed, 30 Jan 2008 08:37:59 -0800 (PST), Crazy Cat > > > > <danbr...@hotmail.com> wrote: > > > >Does anyone know why this is not exposed in the designer? > > > > >Is it just me or is this a really stupid oversight? > > > > >I turn it on in code, but that doesn't prevent the designer from every > > > >once in a while autogenerating columns on my datagridview. I can't > > > >seem to predict when this'll happen -- for example, I've got my > > > >datagridview's datasource set to a bindingsource -- I clear out the > > > >unnecessary colums in the datagridview and start the application. All > > > >is fine. However, on subsequent restarts, sometime I'll see that > > > >columns have been autogenerated in the designer, even though in the > > > >particular edit session, I never changed the datasource, or any > > > >aspects of the bindingsource. > > > > >How to stop this -- it is ANNOYING! > > > > I have run into the same problem. I asked about this here a few > > > months ago but never received a response. > > > > What I finally did was to create a subclass of DataGridView and set > > > AutoGenerateColumns = False in the constructor. > > > Thanks for your response Jack. > > > I tried this and yet it is still autogenerating the columns. It must > > be something I'm doing. > > > I looked at my code and the only thing I can put it down to is that I > > dynamically set the datasource > > in the code, but I set autogeneratecolumns to false in the constructor > > of the derived class and for > > good measure in the grid. In design view I deleted the extraneous > > columns, started the application > > and all was good. As soon as I stopped debugging I notice that > > magically the columns have been regenerated > > in design mode. > > OK, this time I'm pretty sure it's nothing I'm doing. In design mode I > delete the extraneous columns. When I close the form and reopen it in > the designer the columns have been autogenerated. This is only > happening on one datagrid in my application. > > WHAT THE HELL? > > Sign me, > > FRUSTRATED
OK, I found the solution -- Do not set DataSource and DataMember at design time -- set them at runtime and all is fine. Actually you might want to set them at design time to get the bindings for your columns, but after setting the bindings CLEAR OUT THE Datasource and Datamember properties and set them at runtime.
Don't see what you're looking for? Try a search.
|