PPC 2003, adding zeros to a text box

Posted on 2007-08-02
Medium Priority
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 48

Accepted Solution

Wayne Taylor (webtubbs) earned 680 total points
ID: 19616487
Hi tinapardi,

Try txtAWB1.TextLength



Author Comment

ID: 19616574
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

Sancler earned 640 total points
ID: 19621515
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

Mikal613 earned 680 total points
ID: 19623829

Author Comment

ID: 19772049
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.


Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
A short article about problems I had with the new location API and permissions in Marshmallow
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

621 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