如何计算Button点击次数? [英] How to count the number of Button clicks?

查看:187
本文介绍了如何计算Button点击次数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我宣布

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

解决方案

如果我宣布

展开 | 选择 | Wrap | 行号


在Button1_Click事件处理程序之外声明你的计数变量...截至目前,count变量已声明并初始化click事件..


最好在事件方法中声明count变量是静态的..

展开 | 选择 | Wrap | 行号

if I declared

Expand|Select|Wrap|Line Numbers

解决方案

if I declared

Expand|Select|Wrap|Line Numbers


Declare your count variable outside the Button1_Click event handler... As of now the count variable is declared and initialized on click event..


Better to declare count variable to be static inside the event method..

Expand|Select|Wrap|Line Numbers


这篇关于如何计算Button点击次数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆