How to prevent a button from being clicked a second time when there is already an Onclick event in C#


Ken4scholars

How can I prevent the button from being clicked a second time when there is already an Onclick event in C#? For example, is there a button that is clicked again when the Onclick event occurs?

Paul G

To only click the button once, you can set it button.enabled = falsein the onClick()event .

Or if you just want to know if the button has been clicked before, use a simple flag, set it to on the first click true, then on each subsequent click check if it has been clicked and take the appropriate measure.

Related


How to prevent button from moving when clicked?

JustAnotherSimpleProgrammer__ I have the following code: <!DOCTYPE html> <html> <body> <head> <script> function Show(element){ element.style.display = "block"; } function Hide(element){ element.style.display = "none"; } function Slide(){ try{ img1 = im

How to prevent button from moving when clicked?

storm I have several buttons in a div that will display a value once clicked. The problem I'm having is: After a button is clicked and a value is displayed, it also moves down. I'm not sure how to prevent this from happening. Can someone help? Here is a link t

How to prevent button from moving when clicked?

JustAnotherSimpleProgrammer__ I have the following code: <!DOCTYPE html> <html> <body> <head> <script> function Show(element){ element.style.display = "block"; } function Hide(element){ element.style.display = "none"; } function Slide(){ try{ img1 = im

How to prevent button from moving when clicked?

JustAnotherSimpleProgrammer__ I have the following code: <!DOCTYPE html> <html> <body> <head> <script> function Show(element){ element.style.display = "block"; } function Hide(element){ element.style.display = "none"; } function Slide(){ try{ img1 = im

How to prevent button from moving when clicked?

JustAnotherSimpleProgrammer__ I have the following code: <!DOCTYPE html> <html> <body> <head> <script> function Show(element){ element.style.display = "block"; } function Hide(element){ element.style.display = "none"; } function Slide(){ try{ img1 = im

How to prevent button from moving when clicked?

JustAnotherSimpleProgrammer__ I have the following code: <!DOCTYPE html> <html> <body> <head> <script> function Show(element){ element.style.display = "block"; } function Hide(element){ element.style.display = "none"; } function Slide(){ try{ img1 = im