Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Increase control value by one...

Status
Not open for further replies.

song2siren

Programmer
Jun 4, 2003
103
GB
Hi

I've got a label control on which I need an onclick event so that every time a button is clicked the current value is increased by one. The label control will always contain an integer.

I'm sure this is really simple but having trouble converting the value of the label to an integer. Any suggestions would be very much appreciated.

Thanks
 
Code:
int labelValue = 0;
try
{
   labelValue = int.Parse(Label1.Value)
}
catch {}

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Thanks Dazzled

Forgot to add that the label and button will be in a datagrid, so there will be multiple controls when the records are returned. So, I need a way of increasing the value of the label for the particular row selected.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top