Re Usable components

  • Thread starter Thread starter Pure Heart
  • Start date Start date
P

Pure Heart

hi

i want to make classes and components that i can re-use in developing
applications seems that just compiling and adding a referance of the dll to
my projects is not enough to let me use the classes inside them so haw can
that be done ?

and whats the difference between class and component ? i mean what shall i
do with the component user interface since i wont put controls and text boxes
on it ?
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
and adding a referance of the dll to my projects is not enough

It should be... are the classes declared public?
Also - do you mean via code, or via the GUI designer? If the latter you
might need to use the "Choose Items..." option on the toolbox to make
them visible.

Marc
 
hi

thank you for yor answer but i dont see any relation with my question :)
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
thank you for yor answer but i dont see any relation with my question :)

In what sense? You are saying that adding a reference isn't enough...
well, the fact is: it is! If it isn't working, then either the classes
are internal (in which case you need to make them public), or you are
talking about the designer, which has a separate list of what it displays.

If you having a more specific error (i.e. more than you simply can't
find the classes), then post the error!

Marc
 
i choosed new project then class library type, add some public class and
complied it
to a dll, then added a referance to that dll in another project is that
enough ?
i dont know what you mean by saying making the class public ? i defined it
as public but is there another thing i should do ?
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
i defined it as public

That should be enough. You should now be able to find the class (with
the requisite namespace declarations). For example, the class might be
ClassLibrary1.Class1 - in which case either add "using ClassLibrary1",
or use the explicit ClassLibrary1.Class1 syntax (obviously the names
will vary!).

Marc
 
you mean just

public class

end class

and thas it > cuz that didnt wok with me ?
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
public class
end class

No, mainly because that won't compile... but something like

public class Foo {}

should work; then after adding a reference you should be able to use

Foo foo = new Foo();

etc in the second project.

Marc
 
Oops; just realised this is "dotnet.general", not C#, so ignore the last
comment ;-p

But are you *sure* you are adding the reference?

Marc
 
Back
Top