Newbie - Use a class in another file

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

Hi

I am using vb.net on aspx web pages.

I have a codebehind file that contains the class, functions, etc necessary
for that particular web page.

However, i also want to create a class in a separate VB file, which will
contain common functions, etc that will be used by many other classes/pages.

Can you do this in vb.net, ie use a class that is in another file (FileA.vb)
using some reference to that file in FileB.vb, or do you have to compile
FileA.vb into a namespace and then use it from the other class files?

Inheritance is an option, but again how would you do this if the class i
want to inherit from is in another vb file. I could put all these classes
into one file and subclass my heart out, but that could mean large
codebehind files - is that a problem?

Hope someone can point me in the righ direction for this - i am used to
using delphi where u can just reference the other files required in the
"uses" section and then quite happily called their methods, etc

Cheers
 
You can either create a class file in your Web Application project and
create an instance of the class in your code, or you can create a utility
class with static methods so you can use the functionality without having to
create an instance.
 
Back
Top