vb6 Kuwait
  • 19 years ago

    The problem with the code is that you declare the variable at the wrong place. Every time the user clicks the button, the variable is declared and the value will be null + 1, so you'll always get 1 as the answer. At the 'End Sub' of this procedure, the variable is destroyed.
    You must declare the variable at the module level (at the beginning of the form's code) so it will be available for every procedure on this form, and it will hold its value. :-)

  • 19 years ago

    What exactly do you mean by "correcting" a random variable?

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou