Number format starts with 0000

hi friends

I read the current invoice number from text file and increment it by 1 ,
again update the text file with incremented value.

Ex: Text file : current inv no : 0000000001
Conver to int + 1 —> is changed as 2.

its updated in text file as 2.
0 is removed.
i want to update the text file as 0000000002.

please help.

@oshan
With current as the string from your text, the text you want to paste will be:

Strings.Format(CInt(current) + 1, "0000000000")

2 Likes

@oshan,

Use String.Pad function. Here I used 9 since you need 9 leading zeros before your number.

yourString.PadLeft(9, "0"c)
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.