create a library of function to be used from multiple places

  • Thread starter Thread starter Sammut
  • Start date Start date
S

Sammut

Hi,

I am trying to create a class in which I create a number of functions that
I can call from differenet places in my program.

I create a new class called ecs
Then I create a function in it whic returns a string.

Then I went in my main form and tried to call the function with out any
sucess. Here is my ecs.cs class. Can anyone see what am I doing wrong


using System;
namespace test
{
/// <summary>
/// Summary description for ecs.
/// </summary>
public class ecs
{

//
public string sMask (string sText)
{
string sVar = "";
return sVar;
}
}
}

when I try to call ecs.sMask I get an error as if the function is not
defined
 
Sammut,

The reason for this is that you need to create an instance of the ecs
class and then make the method calls on that.

Hope this helps.
 
You shouldn't have to declare an instance of the class. I suspect you just
aren't in the same namespace. Or if you are compiling this separately you
need to add the reference to the assembly to the project.

:) Thom
 
Back
Top