You are currently browsing the tag archive for the 'vb.net' tag.
Here’s a function for adding leading zeros to a number. I have it set to add up to five zeros:
Public Function LdgZero(ByVal x)
If x < 10 Then
x = "00000" & x
ElseIf x >= 10 And x < 100 Then
x = "0000" & x
ElseIf x >= 100 And x < 1000 Then
x = "000" & x
ElseIf x >= 1000 And x < 10000 Then
x = "00" & x
ElseIf x >= 10000 And x < 100000 Then
x = "0" & x
Else : MsgBox("Does not compute.")
End If
Return x
End Function
