Click here to Skip to main content
12,635,139 members (25,774 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET .NET C#4.0 .NET4
i have three textboxes............in one textbox i input value 1000
and on its TextBox1_TextChanged i want to calculate values (1000+10%of1000) on textbox2

and (1000+20%of1000) on textbox3 and want to use only one method cal and want this method to be in a class

and in TextBox1_TextChanged: through class object method cal should be invoked
is this possible
pls tell
regards
Posted 2-Jan-13 2:25am
Comments
jibesh 2-Jan-13 7:30am
   
to return multiple values from a method is simple and you can achieve that using the ref keyword is that what you want? is that enough for you?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

To return multiple values you can use either ref or out keyword as your arguments eg:

you can use /out
void ReturnMultiple(out string value1,out int value2,out flow value3)
{
   value1 = "value1";
   value2 = 0;
   value3 = 100.0f;
}
or
void ReturnMultiple(ref string value1,ref int value2,ref flow value3)
{
   value1 = "value1";
   value2 = 0;
   value3 = 100.0f;
};


Read more about 'ref' and 'out' Keywords here
What is the difference between the ref and out keywords in C#?[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Protected Void TextBox1_TextChanged(Sender s,Object e)
{

Str= CalculateBoth(val1,val2,val3);
string[] words = str.Split(',');
Txt1.Text=words[0];
Txt2.Text=words[1];
} 
static void CalculateBoth(int a,int b,int c)
{
int d=a + b % c;
int e=a + (b+10) % c;
string str= convert.toString(d) + "," + convert.toString(e);
return str;   
}


This Is For Example You can Do Like This...
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161208.2 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100