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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Development Tools
 ASP.NET
 Using forms in another form
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Wouter Benoit
Starting Member

Belgium
23 Posts

Posted - 06/03/2008 :  12:25:51  Show Profile  Reply with Quote

Hello,

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

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 06/03/2008 :  13:04:52  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
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;
C.SomeMethod();

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
http://weblogs.sqlteam.com/JeffS

Edited by - jsmith8858 on 06/03/2008 13:33:37
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000