How To convert textbox value as int and pass in in for loop.

Posted by Anishabathija under ASP.NET on 12/11/2012 | Points: 10 | Views : 1963 | Status : [Member] | Replies : 2
hey ,

I have a text box value.

I want to convert it int int and pass it in my for loop.




Responses

Posted by: Pavanandey on: 12/11/2012 [Member] Bronze | Points: 25

Up
0
Down
for (CountLine = 0; CountLine < Convert.ToInt32(txt.Text); CountLine++)
{
// make sure your text box has some value
}

Thanks
Pavan Kumar
Mark Answer if this fits the need

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

Posted by: Ranjeet_8 on: 12/11/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this,

try
{
int Val = 0;
if (textboxCost.Text.Trim() != "")
Val = Convert.ToInt32(textboxCost.Text);
for (int i = 0; i < Val; i++)
{
// Your code goes here...
}
}
catch { }


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

Login to post response