VS2005, C # - Combined Data Codes - Code behind is giving me default errors

In the designer.cs piece of code, I just created a combo boxes database (it was looking at the data in order so this works), but when I try to compile it throws me two unique errors:

1) Error 1 Type of type 'mtdDesktopApplicationDataSet' does not exist in type 'DesktopApplication.DesktopApplication'

2) Error 2 Type of type "mtdDesktopApplicationDataSetTableAdapters" does not exist in type "DesktopApplication.DesktopApplication"

The first error is on the first line, the other error is displayed wherever "mtdDesktopApplicationDataSetTableAdapters" (4 lines)

All the relevant files seem to be there, but are they just not connecting correctly?

this.mtdDesktopApplicationDataSet = new DesktopApplication.mtdDesktopApplicationDataSet();
this.tblStudyBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblStudyTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblStudyTableAdapter();
this.tblDeliveryGroupBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryGroupTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryGroupTableAdapter();
this.tblDeliveryBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryTableAdapter();
this.tblDeliveryDataSetBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryDataSetTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryDataSetTableAdapter();
 ((System.ComponentModel.ISupportInitialize)(this.mtdDesktopApplicationDataSet)).BeginInit();
 ((System.ComponentModel.ISupportInitialize)(this.tblStudyBindingSource)).BeginInit();
 ((System.ComponentModel.ISupportInitialize)(this.tblDeliveryGroupBindingSource)).BeginInit();
 ((System.ComponentModel.ISupportInitialize)(this.tblDeliveryBindingSource)).BeginInit();
 ((System.ComponentModel.ISupportInitialize)(this.tblDeliveryDataSetBindingSource)).BeginInit();

      

+1


a source to share


2 answers


I am guessing that you are having some namespace issues. If this code-behind file is in the namespace DesktopApplication

and you also have a class DesktopApplication

in the namespace DesktopApplication

, you will experience this.

(He mostly looks at DesktopApplication.DesktopApplication

when he should be looking instead DesktopApplication

.)



Try clearing your namespaces so the above is wrong, or avoid the hellish namespace with the keyword global

:

this.mtdDesktopApplicationDataSet = new global::DesktopApplication.mtdDesktopApplicationDataSet();

      

+2


a source


Moved / renamed files / classes at any point and / or changed the default namespace for the project? I have seen that they all have similar effects to the above.

Returns the (generated) string:

this.mtdDesktopApplicationDataSet =
        new DesktopApplication.mtdDesktopApplicationDataSet();

      



It is probably worth avoiding that fields ( this.mtdDesktopApplicationDataSet

) are named the same as types ( DesktopApplication.mtdDesktopApplicationDataSet

), which can only lead to errors. It is not clear (without being able to reproduce it) if this is a factor here, but it cannot help ...

What is the field mtdDesktopApplicationDataSet

for the presentation? Can you rename it?

+2


a source







All Articles