Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
auto generated number
#4
Well, first of all, you would need an integer variable to keep track of the number, so we can do this with something like this:
[code2=vbnet]Private Counter As Integer = 0[/code2]

Then, Every time we need to increment the variable, we can do so with:
[code2=vbnet]Counter += 1[/code2]

However, when we display the variable to the user, we would like it to be in the proper format. Since your number is 6 characters long, we pad left by 6 characters and fill any empty spots with 0s. Like so,
[code2=vbnet]Dim cString As String
cString = Counter.ToString.PadLeft(6, "0"c)[/code2]

Hopefully this helps.
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
auto generated number - by jochen29 - 09-29-2012, 07:16 PM
Re: auto generated number - by jochen29 - 10-01-2012, 05:06 AM
Re: auto generated number - by brandonio21_phpbb3_import2 - 10-01-2012, 02:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Auto-generating Drop Menus from User Input MadManMallard 2 12,537 09-17-2014, 09:41 AM
Last Post: brandonio21
  Random Number Generator manishshrestha60 4 15,632 10-30-2012, 05:43 PM
Last Post: brandonio21
  i need help on making a launcher with auto updating function jamietjeh 2 12,365 12-16-2011, 07:24 PM
Last Post: xolara

Forum Jump:


Users browsing this thread: 1 Guest(s)