c# - Using a Button Tag -
Program logic changes a button tag based on random things - but using the UI thread. Is the button tag value reliable to use in a click event? That is, will it be the same value as the event occurs at the handler, because it was at the time of the click? If not, what is the best way to pass an event specific parameter on the button, click on the event that will be safe? Update An example was added as a request. (Remember this is just theoretical). windows.form. Timer timer = new timer (); Timer Interval = 1; Timer Tick + = new event handler (timer_tick); Timer.start (); Zero timer_tick (object sender, event events e) {this.button.Tag = Random.NextInt (100). Ostring (); } Zero button_click (object sender, eventArgse E) {string s = (string) ((button) sender) .tag; Console. Light line ("tag value as push button:" + s); } Enter another way, the question has emerged: Events can be covered in the GUI event queue which pushed the position of the button and allows ...