View previous topic :: View next topic |
Author |
Message |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Sat Nov 17, 2007 9:29 am Post subject: vb6 numbers |
|
|
ok like when i click the "click" button in text1 it increase by 1? i been trying to do it and finally gonna ask how |
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sat Nov 17, 2007 9:37 am Post subject: |
|
|
It's something like this
Code: | text1.Text = text1.Text + 1 |
or
Code: | text = Val(text1.Text) + 1 |
_________________
|
|
Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Sat Nov 17, 2007 9:40 am Post subject: |
|
|
I think youre thinking of a label?
I would do it like this
Declare this variable:
Code: | Dim intNumber as Integer |
On form_load:
And then make a button, label and timer
On timer:
Code: | Label1.Caption = intNumber |
Make interval around 100
On button code:
Code: | IntNumber = IntNumber + 1 |
|
|
Back to top |
|
 |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Sat Nov 17, 2007 9:41 am Post subject: |
|
|
Blader wrote: | It's something like this
Code: | text1.Text = text1.Text + 1 |
or
Code: | text = Val(text1.Text) + 1 |
|
dont works none
Edit: thx moller works good |
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sat Nov 17, 2007 9:45 am Post subject: |
|
|
It works for me
When I click the command button, the text box value goes up by 1
Set up a command button and a textbox, and put the number 1 in the textbox
Add this code to the command
Code: | Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
Text1.Text = Text1.Text + 1
End If
End Sub |
EDIT: Oh I see what you meant, nvm _________________
|
|
Back to top |
|
 |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Sat Nov 17, 2007 9:55 am Post subject: |
|
|
Blader wrote: | It works for me
When I click the command button, the text box value goes up by 1
Set up a command button and a textbox, and put the number 1 in the textbox
Add this code to the command
Code: | Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
Text1.Text = Text1.Text + 1
End If
End Sub |
EDIT: Oh I see what you meant, nvm | this works also thx |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Nov 17, 2007 1:04 pm Post subject: |
|
|
If you are using the number for something other then display, you should always store it in a numeric data type and not just use the text to increase the number. Just a suggestion. _________________
- Retired. |
|
Back to top |
|
 |
darkbobert How do I cheat?
Reputation: 0
Joined: 08 Mar 2007 Posts: 0
|
Posted: Sat Nov 17, 2007 9:59 pm Post subject: |
|
|
Code: | text1.text = val(text1.text)+1 |
but if ur just useing it to display something id use a label box insted
Code: | label1.caption = val(label1.caption)+1 |
|
|
Back to top |
|
 |
|