This is a first for me, I thought I was completely losing my mind. I have a simple winform application to which I add a datagridview. I set the datasource for the dgv, using the same source I’ve used in half a dozen other projects, and configure the grid the way I want it. There is nothing else on the form at this point except for the grid, and the project now contains a data set, a binding source, and a table adapter. Great. However, the code generated by the designer in doing this is invalid and is causing compile errors, telling me that the data set table adapters object and the data set itself does not exist.
If I go into the designer where the compile error is I see the following lines:
this.tILEDataSet = new ImageEdit.TILEDataSet();
this.logosTableAdapter = new ImageEdit.TILEDataSetTableAdapters.LogosTableAdapter();
ImageEdit is the class to which I have added this bound control. If I remove the “ImageEdit.”, the code compiles and works perfectly. Of course, since this is a designer generated file, as soon as I make any other changes, it reverts back to the code in question.
I did this three times, with three different projects, twice starting from scratch with a fresh instance of visual studio.
What could be going wrong to cause this to happen, and is there a fix, other than manually editing a designer file, which I never like to do?
I did not change anything, everything was generated by the designer. Both the namespace and class were created as ImageEdit. The designer contains the following definitions:
private TILEDataSet tILEDataSet;
private TILEDataSetTableAdapters.LogosTableAdapter logosTableAdapter;
The designer class definition does derive from global::System.ComponentModel.Component:
public partial class LogosTableAdapter : global::System.ComponentModel.Component {
.
.
.
Thanks again for any insight.
I suspect you have several members in your solution named
ImageEdit, whether they be namespaces, classes, or other members. In Microsoft’s Guidelines for Names, and in particular, Names of Namespaces they recommend:The second point alone should fix your issue. Using the first point, a company name as part of the namespace, will cause the code generator to provide a more concise name for your objects, such as: