473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

create a library of function to be used from multiple places

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

Nov 16 '05 #1
2 1162
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sammut" <sa*****@nextgen.net.mt> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #2
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

"Sammut" wrote:
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

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
19
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with...
6
by: Johs32 | last post by:
I get this warning: warning: incompatible implicit declaration of built-in function 'printf' because I use printf in a function that I include in a .h file that is included by other files...Do...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.