|
-
Mar 2nd, 2004, 12:30 PM
#1
Thread Starter
Lively Member
Function Error
Hello Everybody:
I am trying to develop a function to concate three strings . When I compile it gives me a compile error .Can anyone tell me whats wrong?
The error is :
Method 'Project01.Form1.Variable(string, string, string)' referenced without parentheses
public string Variable(string UserName, string PhoneNumber, string RemoteYN)
{
UserName= txtUserName.Text;
PhoneNumber= txtPhoneNumber.Text;
RemoteYN= txtRemoteString.Text;
return Variable= String.Concat( UserName, PhoneNumber, RemoteYN);
-
Mar 2nd, 2004, 12:48 PM
#2
Addicted Member
I am trying to understand what it is you are doing.
is this the output u are looking for?
UserNamePhoneNumberRemoteYN
Secondly how are you calling this function.
-
Mar 2nd, 2004, 12:57 PM
#3
Thread Starter
Lively Member
Function Error
I am looking for the output as
UserName PhoneNumber RemoteYN in a text box.
I am calling the function as :
private void cmdOutPut_Click(object sender, System.EventArgs e)
{ txtOutput.Text=Variable ;
}
Originally posted by Tewl
I am trying to understand what it is you are doing.
is this the output u are looking for?
UserNamePhoneNumberRemoteYN
Secondly how are you calling this function.
-
Mar 2nd, 2004, 01:17 PM
#4
Addicted Member
Re: Function Error
Originally posted by Rahils573
private void cmdOutPut_Click(object sender, System.EventArgs e)
{ txtOutput.Text=Variable ;
}
You have to pass values with the Variable function
In you first posted you showed the function as having three parameters so unless you write a function with no parameters you must pass values. For example
Code:
txtOutput.Text = Variable(string1, string2, string3);
plus concat joins the strings together it does not add spaces between the values for you.
why not do
Code:
txtOutput.Text = txtUserName.Text + " " + txtPhoneNumber.Text + " " + txtRemoteString.Text;
-
Mar 2nd, 2004, 01:38 PM
#5
Thread Starter
Lively Member
Function Error
I tried what u suggessted but it still giving me a error : Says not all code return a value..
Project01.Form1.Variable(string, string, string)': not all code paths return a value
Gives error when I define
public string Variable string UserName, string PhoneNumber, string RemoteYN)
public string Variable(string UserName, string PhoneNumber, string RemoteYN)
{
UserName= txtUserName.Text;
PhoneNumber= txtPhoneNumber.Text;
RemoteYN= txtRemoteString.Text;
}
private void cmdOutPut_Click(object sender, System.EventArgs e)
{ txtOutput.Text= Variable(UserName,PhoneNumber,RemoteYN);
txtOutput.Text = txtUserName.Text + " " + txtPhoneNumber.Text + " " + txtRemoteString.Text;
-
Mar 2nd, 2004, 07:53 PM
#6
Frenzied Member
PHP Code:
public void Variable(string UserName, string PhoneNumber, string RemoteYN)
{
UserName= txtUserName.Text;
PhoneNumber= txtPhoneNumber.Text;
RemoteYN= txtRemoteString.Text;
}
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|