hey every1

im struggling with something simple, that i cant figure out, or im on the wrong track.

the user must enter an id of any sort, 1 - 8 numbers, if it is less than 8 numbers it must be left padded with 0s. and the 1st character must b a Alphanumeric char.

sofar on my masked textbox i got this as the mask L00000000 as this does what i want, but doesnt left pad with the 0s.

is there a simple way to fill the empty spaces with 0s? or am i going to use a for loop that will add a 0 to the front(after the Letter .

thanx

i see there is a left pad method i can use, but to get it to left pad, after the 1st Character.... hmmm i sense a substring.... bleh... hope im on the right track now

lol ive solved it myself.... XD

anyway, if any1 does need the code here it is

string orig = maskedTextBox1.Text;
            int len = orig.Length;
            string mask = orig.Substring(1, len - 1);
            string s = orig.Substring(0, 1);
            mask = mask.PadLeft(8, '0');
            label3.Text = s + mask;

it could most probably be done in a cleaner way, but im no expert.
=] enjoy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.