Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

when debuging, when program finish window closes how can i stop this

$
0
0
i am new to vb and on quite the learning cure. i am workng on a program with random number generators, multiple timerers, and usb rlay and i/o. everything was going fine untill i got to a point where i needed a random number generator to create a number, wait for a timer to expire, then creat another number. it needed to do this untill a master timer expired. i finally got this to work the way i wanted, but now when the master timer expires, it closes all the forms. it didnt do this be for. here his the script i added. i didnt change anything on any of the timers. i need for the form 1 to stay open.
 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        Button2.Enabled = False
        If Form2.RadioButton5.Checked = True Then random()

    End Sub

    Private Sub random()

        Do
            Form2.Timer1.Enabled = True
            Label3.Text = Label3.Text + 1

            Dim rndnumber As Random
            Dim number As Integer
            rndnumber = New Random
            number = rndnumber.Next(1, 4)
            Form2.Label2.Text = number.ToString

            Do Until Form2.Timer1.Enabled = False
                If Timer1.Enabled = False Then End
                Application.DoEvents()
            Loop
        Loop

    End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles