Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Using forms in another form

Author  Topic 

Wouter Benoit
Starting Member

23 Posts

Posted - 2008-06-03 : 12:25:51


I'm creating an application in C# and I want to use functions of one form in the other.
But when I do so I get the error:

The type or namespace name 'SpelScherm' could not be found (are you missing a using directive or an assembly reference?)

Now I know that in vb.NET you have to do

Imports project.form

And then you can access the controls and functions from that form in the oter one.
But in C# I can't get it to work.

Can someone please explain me what I can do about it.

Thanks in advance

Dr. Cross Join

7423 Posts

Posted - 2008-06-03 : 13:04:52
C# uses "Using" instead of "Imports".

Also, in VB.NET, you can import a Class Name, but in C#, you can only specify "Using" for Namespaces.

So, if in VB.NET you have:

Imports A.B.C
SomeMethod() ' calls C.SomeMethod()

You would write that in C# as:

using A.B;

Of course, when in doubt, simply fully-qualify everything. And be sure your methods and properties are not private, and that if you are not creating an instance of a form that they are static.

If none of that makes sense: get a book on beginning C# and read it carefully! This stuff is a very important concept to completely understand.

- Jeff
Go to Top of Page

- Advertisement -