Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2005
Posts: 5
Reputation: mwaora is an unknown quantity at this point 
Solved Threads: 0
mwaora mwaora is offline Offline
Newbie Poster

Help

 
0
  #1
Jun 21st, 2005
AM trying to use a string "0000" to generate an auto number. i.e 0000 +1 to increment to 0001. how do i achieve this.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 29
Reputation: vhinehds is an unknown quantity at this point 
Solved Threads: 0
vhinehds's Avatar
vhinehds vhinehds is offline Offline
Light Poster

Re: Help

 
0
  #2
Jun 23rd, 2005
Originally Posted by mwaora
AM trying to use a string "0000" to generate an auto number. i.e 0000 +1 to increment to 0001. how do i achieve this.

**************************************************

hope this one helps...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim x as integer 'declare first variable
  2.  
  3. x = 0 'set the value of your variable
  4.  
  5. for x = 1 to 2000
  6.  
  7. s = len(str(x)) 'here we will check the length of x
  8.  
  9. select case s
  10.  
  11. case 1
  12. x2 = "000" & str(x)
  13. case 2
  14. x2 = "00" & str(x)
  15. case 3
  16. x2 = "0" & str(x)
  17. case 4
  18. x2 = str(x)
  19.  
  20. end select
  21.  
  22. next x
  23.  
  24. msgbox str(x2)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC