Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a parameter called "QUANTITY" and want a messagebox to count to the value of the parameter.
The code I have now counts as 1 -> 2 -> 3 -> etc., but I want to count it as 001 -> 002 -> 003 -> etc..
Below you can find the code I use now, is it possible to edit the code so it does count as 001? The QTY_index should always have 3 characters, so if the QUANTITY is 54 the QTY_index should be 054.
Dim FileName As String
For QTY_index As Integer = 1 To QUANTITY
FileName = "PartInformation_" & QTY_index
MessageBox.Show(FileName, "FileName")
Next
*Edit: I just thought about using this (below), but if someone has a better idea please let me know : )
Dim FileName As String
Dim Help As String
For QTY_index As Integer = 1 To QUANTITY
If QUANTITY>= 0 And QUANTITY< 10 Then
Help = "00"
ElseIf QUANTITY>= 10 And QUANTITY< 100 Then
Help = "0"
Else
Help = ""
End If
FileName = "PartInformation_" & Help & QTY_index
MessageBox.Show(FileName, "FileName")
Next
Check out my ideas: https://autode.sk/2TKe6LH
Solved! Go to Solution.