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.

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

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



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

yourString.PadLeft(9, "0"c)
1 Like

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