how to get numeric value from string and assign it to variable in c#.net

Posted by Rrana under ASP.NET on 9/13/2011 | Points: 10 | Views : 2133 | Status : [Member] | Replies : 3
Hi,

how to get numeric value from string and assign it to variable in c#.net

for Example:

textbox.text="Minutes : 5"

minutes range is 0 to 60

i want 5 in another variable



Thanks in advance

Sucharitha Goud
Bank Of America..



Responses

Posted by: Kasibabu on: 9/13/2011 [Member] Starter | Points: 25

Up
0
Down

HI SUCHARITHA

TextBox1.Text = "Minutes : 5";
char[] ch = { ':' };
string min = TextBox1.Text;

string[] anothervariable = min.Split(ch);
Response.Write(anothervariable[0]); // Minutes
Response.Write("</br>");
Response.Write(anothervariable[1]); // 5

if it helps to you don't forgot to make it as answer.



Regards,
Kasi babu

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rrana on: 9/15/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Kasibabu,

i want that 5 into another textbox or lable

Sucharitha Goud
Bank Of America..

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rrana on: 9/15/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Kasibabu,

it's working .
Thanks a lot

Sucharitha Goud
Bank Of America..

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response