Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2010 [RESOLVED] Keep a random number between two forms from a module

$
0
0
So, I'd like to take a randomly generated number, and use it in Form1 and Form2 from Module1. Any idea's how to do this without completely randomizing the number each time it is used?

Code:

Module ModRanGo
    Private RanGo As New Random
    Public Act1 = RanGo.Next(30, 90)
End Module

When I use Act1 in Form1 and Form2, I get a different number in both forms, but I need the number to stay the same between Form1 and Form2 while Form1 does it's loop, then randomize again when Act1 is called for the next loop. Any suggestions?

EDIT: Wow, I'm so lame. It works. I was calling a different function.
Okay, so the problem now is it keeps the same number (thank-goodness), but I need it to generate a new random number when Form1 goes through it's next loop.

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>