12,635,139 members (25,774 online)
Rate this:
See more:
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
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:

## 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;
};```

What is the difference between the ref and out keywords in C#?[^]
Rate this:

## 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...
v2

Top Experts
Last 24hrsThis month
 Richard MacCutchan 140 CPallini 125 ppolymorphe 85 OriginalGriff 84 Mika Wendelius 70
 OriginalGriff 2,408 ppolymorphe 1,331 Peter Leow 1,029 CPallini 806 John Simmons / outlaw programmer 770