×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How do I add a leading Zero in VB

How do I add a leading Zero in VB

How do I add a leading Zero in VB

(OP)
This is probably an easy question for the VB guru....

I would like to set up a combo box to have 001 thru 248 and the numbers 1 thru 99 should include the leading zero(ie: 001, 002, and so on)

What do I need to add to my code below to pull this off? The code below produces (1,2,3, and so on)

For i = 1 To 248
ComboBoxSN.AddItem i '1-248
Next

RE: How do I add a leading Zero in VB

You could try the following:

ComboBoxSn.AddItem Format(i, "000")

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: How do I add a leading Zero in VB

(OP)
Thanks... that worked!!

I figured it was something so simple.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources