13,056,966 members (43,939 online)
Rate this:
See more:
Hello Everyone,

I have Some problem, may be its logical, please help me, the problem is that, that I have a simple page with a Textbox and a Button, actually User's are allowed to enter some comma separated numbers(like 43, 12, 213, 32, 12). Now, when submit, on the back end, I applied some formula in which the greater and lower value required to subtract or also in other words I want to get the input number separately(one by one).

Thanks
Posted 27-Nov-12 16:51pm
Krunal R 27-Nov-12 22:53pm

Rate this:

## Solution 1

on asp.net page
```<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />```

________

code behind

protected void Button1_Click(object sender, EventArgs e)
{
string[] numberArray = TextBox1.Text.ToString().Split(',');

for(int i =0 ; i < numberArray.Length -1; i++)
{
// number compare logic here
}
}
v2
Rate this:

## Solution 2

Hi Mustafa,

```string textbox ="23,35,45,65,75";
string[] input = textbox.Split(',');
int length = input.Length;
int[] result = new int[length];
for(int i=0; i< length;i++)
result[i] = Convert.ToInt32(input[i]); ;
int difference = result.Max() - result.Min();```

--SRJ

Top Experts
Last 24hrsThis month
 OriginalGriff 135 Richard MacCutchan 96 Graeme_Grant 85 UMDC 35 Jitku 30
 OriginalGriff 5,936 RickZeeland 2,044 ppolymorphe 1,893 F-ES Sitecore 1,711 Richard MacCutchan 1,537