Issue
How to change the text of button on the first click? Now it takes two clicks to change the text:
int countt1 = 3;
var buttonn1 = FindViewById<Button>(Resource.Id.buttonn1);
buttonn1.Click += (sender, e)=>
{
if (countt1 >= 0)
buttonn1.Text = string.Format("{0}", countt2--);
};
Solution
As @Jason points out, using the postfix decrement operator (countt2--) gives the value before the decrement occurs. For the value after the decrement occurs, change to the prefix decrement operator like this:
buttonn1.Text = string.Format("{0}", --countt2);
Answered By - Mark Larter
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.