473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 19130
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 ...............
Apr 20 '21 #7

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

Similar topics

0
by: Peter | last post by:
When I issue call sqlj.install_jar('file:///f:/jars/mail.jar','MAIL'); I get the messages SQL4301N Java or .NET interpreter startup or communication failed, reason
388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
5
by: Dan C Douglas | last post by:
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in...
5
by: Robin Tucker | last post by:
My database has a column for numeric data items. How can I use this number in the "format" command, such that for, say precision 2, I get numbers like 2011.01 or 2387.00 and for 4 I would get...
12
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL...
43
by: markryde | last post by:
Hello, I saw in some open source projects a use of "!!" in "C" code; for example: in some header file #define event_pending(v) \ (!!(v)->vcpu_info->evtchn_upcall_pending & \...
3
by: duprejonathan | last post by:
Hello, i don't know how to format a string with an SQL select query for my VB6 App. I have a table like this : Code - Name 1 - Jonathan 2 - Mike .... 9 - Claudia 10 - Robbie
3
by: Kosmos | last post by:
Hey ya'll...I can't seem to figure out why I'm getting this error message, but it all started when I added the new line of code with the recSet5.AddNew --- when I ran the first line, the logic worked...
1
by: Vitaliy | last post by:
Hi I got this wired exception periodically (Python 2.5, Django based application) what does it mean ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.