Jump to content

Visual Basic Question


AdmiralZ

Recommended Posts

Ok, obviously we have some programmers here, so I'd like to know something, if anyone can help me. In VB, say I have a variable "intNumber", and its value is "0". I also have a button called "cmdAddone". What do I put inside the button's code to get it to add "1" to "intNumber"? Basically what I am trying to do here is get a program to display a number and then add one onto it every time you click the button. How do I do that?
Link to comment
Share on other sites

im not exactly sure what you mean but... i put the "Dim intNumber As Integer" in the 'general' part of the coding and if you mean if you set the varible to something different..like 2005 you needa put "intNumber=2005" in the command button code i think edit: that works..the way i think you want it? Dim intNumber As Integer Private Sub command1_Click() intNumber = intNumber + 1 Label1.Caption = intNumber End Sub Private Sub Form_Load() intNumber = 2004 End Sub
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...