if i have: ///-Codebehind asp Click event if ((accountSystem.AddUser(txtUserName.Text, txtProfID.Text,txtPassword.Text, UserValue)) > -1) { accountSystem.SetCookie(txtUserName.Text, txtProfID.Text,UserValue); Message.Text = "REGISTRATION COMPLETED!!!!"; } else
{ Message.Text = "Registration Failed"; } ///-Different class file public int Adduser(String PW, String name, int ValueNum) { //Something UserValue = (int) parameterUserId.Value; retune } private voide SetCookie(int ValueNum) { //something } I need ValueNum
to hold the value that was set in AddUser method and pass it in to the SetCookie method. sorry this must be a stupid question thanks
//...declare UserValue somewhere around here ...
///-Codebehind asp Click event
if ((accountSystem.AddUser(txtUserName.Text, txtProfID.Text,txtPassword.Text, out UserValue)) > -1)
{
accountSystem.SetCookie(txtUserName.Text, txtProfID.Text,UserValue);
Message.Text = "REGISTRATION COMPLETED!!!!";
}
else
{
Message.Text = "Registration Failed";
}
///-Different class file
public int Adduser(String PW, String name, out int ValueNum)
{
//give ValueNum a value some where around here ....
ValueNum = 10;
}
When you use an output parameter, then ValueNum requires an assignment before returning from AddUser. In general uou can also use a reference (ref) instead of an output parameter. I am sure that more on output and reference parameters and how to use them
can be found in the Studio.NET help.
"Computer science is no more about computers than astronomy is about telescopes."
Yureek
Member
255 Points
51 Posts
Basic question from a week old C# programmer
Aug 11, 2003 03:18 PM|LINK
weakestlink
Participant
925 Points
185 Posts
Re: Basic question from a week old C# programmer
Aug 11, 2003 03:45 PM|LINK
The late Edsger W. Dijkstra.
Yureek
Member
255 Points
51 Posts
Re: Basic question from a week old C# programmer
Aug 11, 2003 03:55 PM|LINK
weakestlink
Participant
925 Points
185 Posts
Re: Basic question from a week old C# programmer
Aug 11, 2003 07:04 PM|LINK
//...declare UserValue somewhere around here ... ///-Codebehind asp Click event if ((accountSystem.AddUser(txtUserName.Text, txtProfID.Text,txtPassword.Text, out UserValue)) > -1) { accountSystem.SetCookie(txtUserName.Text, txtProfID.Text,UserValue); Message.Text = "REGISTRATION COMPLETED!!!!"; } else { Message.Text = "Registration Failed"; } ///-Different class file public int Adduser(String PW, String name, out int ValueNum) { //give ValueNum a value some where around here .... ValueNum = 10; }When you use an output parameter, then ValueNum requires an assignment before returning from AddUser. In general uou can also use a reference (ref) instead of an output parameter. I am sure that more on output and reference parameters and how to use them can be found in the Studio.NET help.The late Edsger W. Dijkstra.