468,294 Members | 1,834 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

how to format number "0000"

hello,
i would like to know how to do numbering format for "0000" where each time it will generate 0001,0002,0003 and so on untill 9999.

counter = "0000"
counter = counter + 1
Mar 5 '08 #1
6 16831
QVeen72
1,445 Expert 1GB
Hi,

Try This :

Declare MyCounter as Form Level Variable as Integer

Expand|Select|Wrap|Line Numbers
  1. 'Code in Form Load:
  2. MyCounter = 0
  3. 'Code to get next Number:
  4. MyCounter = MyCounter + 1
  5. Text1.Text = Format(MyCounter,"0000")
  6.  
Regards
Veena
Mar 5 '08 #2
debasisdas
8,127 Expert 4TB
try using this

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Static cnt As Integer
  3. cnt = cnt + 1
  4. Text1.Text = Format(cnt, "0000")
  5. End Sub
  6.  
Mar 5 '08 #3
i'm using VB 6.0 and is this code can be run on VB 6.0?i already test it, it cannot generate 0001,0002.
By the way thank you for answering my question. Really appreciate it
Mar 5 '08 #4
QVeen72
1,445 Expert 1GB
Hi,

Yes the Code is for VB6..
So you have tested..
If it is not correct, then what is shown in the TextBox...?

REgards
Veena
Mar 5 '08 #5
debasisdas
8,127 Expert 4TB
Are you facing any problem or getting any error in the code ?
Mar 5 '08 #6
Thank You .......
It worked perfectly ...............
3 Weeks Ago #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

388 posts views Thread by maniac | last post: by
5 posts views Thread by Dan C Douglas | last post: by
5 posts views Thread by Robin Tucker | last post: by
43 posts views Thread by markryde | last post: by
3 posts views Thread by duprejonathan | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.