views:

115

answers:

2

I tried to create a class library that is being used in a winforms application in C#.

In my application I have input from a textbox and through a button click I'm instantiating my event with one parameter (from the textbox). I tried to create a constructor with this one parameter - but to no avail. It seems if I just add a class to be existing project I can do this but not when referencing a class library.

Just wanted to find a way to use a one parameter constructor within a class library if possible. Please help. (this may not work logically because when I reference the class library - I am actually going outside the original assembly - but maybe....)

+3  A: 

If your new class library is in a separate C# project you need to set a reference to that project from your WinForms app before you can use the class.

Of course I'm trying to read between the lines of your original post. It sounds like you know how to make it work, just not when the class is defined in a seperate project. If I've misunderstood, please give more info.

Darvis Lombardo
A: 

it sounds like you don't have two constructors... (overloaded) for your class such as

public class YourClass
{
   public YourClass()
   {
   }


   public YourClass(String OneParameter)  // this OVERLOADS the default No parameter one
   {
      DoWhatever with your OneParameter...
   }
}
DRapp