It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Loop Code

Moderator: dafunkymunky

Loop Code

Postby Davanand on Tue Jul 15, 2008 1:58 am

Hello All,

I am new to VB and I am trying to accomplish a simple task. I want to run through a loop that will generate a random number. After the termination of the loop I want the button to longer be visble. Right now with the code I have if you click the button once, the button disappears. When I debug everything looks fine. Please help. Below is my code.

Code: Select all
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        For i = 1 To 3
            Form1_Load(sender, e)
        Next
        Button1.Visible = False
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim value As Integer
        value = (Int(Rnd() * 10))
        Label1.Text = value
    End Sub
End Class
Davanand
 
Posts: 0
Joined: Tue Jul 15, 2008 1:46 am

Who is online

Users browsing this forum: No registered users and 3 guests