mardi 2 août 2016

vb generate random number for Form location

i'm making a visual basic program in Visual Studio, where a rather large amount of Forms will show. However, they all popup together in a bunch and only some of them are visible. I'm wondering if there is a way to generate a random integer between two numbers, then setting it as the location of the New Form1. Right now I have this:

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick 
        Dim more As New Form1
        (Code for generating random number from 1 to 999)
        (Code for generating new random number from 1 to 999)
        more.Location = New Point(random number, new random number)
        more.Show()
        time = 10
End Sub




Aucun commentaire:

Enregistrer un commentaire