hi, I want to Count how many times i click a button and display the number in listview.
but i dont know the syntax for counting a button, can someone help me with this problem?
jez9 5 Junior Poster
Recommended Answers
Jump to PostIf you intend to do it with .Net then you would need to post back the button click to the server side code. There you would instantiate a class variable or session variable that held the current count and on each postback when the button was clicked you would increment …
Jump to PostDeclare an integer at the class level as in
Private ButtonClickCount As Integer = 0
Then in the button click event handler do
ButtonClickCount += 1 Me.Text = "Current count = " & ButtonClickCount
This will display the count in the title …
Jump to PostSimply Declare
Dim count As Integer
As global variable then under the buttonClick event handler at the very beginning of it add this.
count = count +1 lblDisplay.Text = count
That will keep on adding the number as you click …
All 12 Replies
hericles 289 Master Poster Featured Poster
jez9 5 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Santanu.Das 125 Santanu Das
jez9 5 Junior Poster
Santanu.Das 125 Santanu Das
jez9 5 Junior Poster
Mr.M 89 Future Programmers
Santanu.Das 125 Santanu Das
Minimalist 96 Posting Pro
Santanu.Das 125 Santanu Das
jez9 5 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.