PPC 2003, adding zeros to a text box

Posted on 2007-08-02
Last Modified: 2013-11-18
I have a text box that keeps taking off the first digit if it is a zero, so I want to make sure one or more is added to fix this problem. The field is 8 digits long so I would need to fill in one or more zeros to make it to that length, but I can't seem to figure out how to do it using eVB 3.0.

Here is what I thought:
        If txtAWB1.Text.length < 8 Then
            txtAWB1.Text = txtRefNum.Text.PadLeft(8, "0")
        End If

But length is not accepted, I tried len as well, but I must be something wrong. Please help with fixing the code or telling me how I can stop the first digit(s) if it is zero from being dropped off.

Thanks in advance the assistance in this matter.
Question by:tinapardi
    LVL 46

    Accepted Solution

    Hi tinapardi,

    Try txtAWB1.TextLength



    Author Comment

    Thanks for your response but I received this error:

    An error was encountered while running this program: Object doesn't support this property or method: 'txtAWB1.TextLength'

    try again?
    LVL 34

    Assisted Solution

    I don't know eVB 3.0 but, on general VB principles, why do you need to check the length first anyway?  If it's already 8, or more, .PadLeft(8, "0") won't do anything.

    LVL 48

    Assisted Solution


    Author Comment

    I split the points up, Len really should have worked Mikal613, I tried it and it was just not going to happen so I decided to live with the problem. I added in # in the textbox as a quick fix, that way if a zero was the first character it was not dropped off, it worked, not the way I wanted but it worked.
     The length didn't work either or the padleft, so I wanted to say thanks for the response and the time.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator ( This article presumes a wor…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now