-1

Ok so i tried this method:

Dim random1 As String
random1 = Int((9999999 - 0 + 1) * Rnd() + 0)
TextBox1.Text = random1

The problem is i want fully 7 digits of number

Example: 0824912, 0094246

but the textbox just hide "0"

Anyone help?

Bang1338
  • 1
  • 1
  • Have you looked through all these examples: https://docs.microsoft.com/en-us/dotnet/api/system.random?view=net-6.0 ? – Andrew Mortimer May 22 '22 at 09:53
  • 1
    See for example [here](https://stackoverflow.com/a/3253161) – Shrotter May 22 '22 at 09:54
  • Make sure to set [`Option Strict On`](https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/option-strict-statement) for this project (and set it as the default for new projects). The problem it would point out with the line `TextBox1.Text = random1` might have led you to a solution on your own, such as using [`PadLeft`](https://docs.microsoft.com/en-us/dotnet/api/system.string.padleft), or one of the possibilities available with `.ToString()`. – Andrew Morton May 22 '22 at 16:56

0 Answers0