How to pass a string to a function

S

Sammut

Hi,

I have the following function to which I need to pass a string variable

private string cMask (string sText)
{

}

but ever time I try to compile I get the error
'test.Form1.cMask(string)': not all code paths return a value

Any idea?
Thanks
Ivan Sammut
 
J

Julie

Sammut said:
Hi,

I have the following function to which I need to pass a string variable

private string cMask (string sText)
{

}

but ever time I try to compile I get the error
'test.Form1.cMask(string)': not all code paths return a value

Any idea?
Thanks
Ivan Sammut

private void cMask (string sText)
 
B

Bob Grommes

Well ... the error message tells you what the problem is. If you declare a
string function it must at some point return a string value. Your prototype
returns nothing. Either declare it as void, or put a return statement in
it, and the error goes away.

--Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top