johnny johnny - 1 month ago 5x
C# Question

How do I AppendText to a textbox at the time it is entered without duplication in C# Forms?

I have in a button click event.

Button v = (Button)sender;
currentValue = currentValue + Convert.ToString(v.Tag);

If v.Tag's value is 2 and I click the button twice, I get 2, 22, 2222, etc. for AppendText. I can use something like a condition with,


But that doesn't seem right.

How do I keep it from doubling up? currentValue acts correctly. AppendText does not.


You can set the text directly by assigning to .Text.