VB.NET怎么实现按钮每单击一次,数字a就加1。
PublicaAsShort=1按钮事件:ProtectedSubButton1_Click(senderAsObject,eAsEventArgs)HandlesBut...
Public a As Short = 1
按钮事件:
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
a = a + 1
Label1.Text = a
End Sub
这样写出来只能加一次,再单击就不管用了,Lable1里一直显示为2. 展开
按钮事件:
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
a = a + 1
Label1.Text = a
End Sub
这样写出来只能加一次,再单击就不管用了,Lable1里一直显示为2. 展开
1个回答
展开全部
可以的呀???
Public Class Form1
Public a As Short = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = a + 1
Label1.Text = a
End Sub
End Class
Public Class Form1
Public a As Short = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = a + 1
Label1.Text = a
End Sub
End Class
追问
好像用在ASP.NET上就不行了,点击多少次都是2.
追答
那是的,ASP.NET上用其他方法吧?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询