If you are using String.Format, you need to specify the index for the parameter, not just D3
, so it would be something like this:
Dim r As Byte = 10
Console.WriteLine(String.Format("{0:D3}", r))
Alternatively, you could just use D3
into the ToString of r:
Dim r As Byte = 10
Console.WriteLine(r.ToString("D3"))