[Visual Basic] how to run a set of click events or procedures

Graeme Summers graemebs at bigpond.net.au
Sun Jun 20 20:18:20 EST 2010


Hi Maggie,

Try this...

Set up a form with 7 picture boxes, a button and a timer:



Set the Visible property of each of the picture boxes False.
Then set each Tag property to the numbers that use this rectangle. For example, the top horizontal picture box will have a Tag 02356789, because these are the numbers that use it.

Set the Interval property of the timer to 1000 (1 second).

Now here's the code:

Public Class Form1

        Private Sub tmrCount_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCount.Tick

            Static Num As Integer = 9

            Dim obj As Object

            For Each obj In Me.Controls

                If TypeOf obj Is PictureBox Then

                    obj.Visible = obj.Tag.Contains(Num)

                End If

            Next

            Num -= 1

            If Num < 0 Then

                tmrCount.Stop()

            End If

        End Sub



        Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

            tmrCount.Start()

        End Sub

End Class


What do you think?

regards,

Graeme Summers


----- Original Message ----- 
From: "Maggie" <iaquinto at ozemail.com.au>
To: "VBasic" <vbasic at edulists.com.au>
Sent: Sunday, June 20, 2010 6:46 PM
Subject: [Visual Basic] how to run a set of click events or procedures


>I am using one of Adrian Janson's exercises - similar to the LCD 
> display. In this exercise you can click on a 3 and it shows the numeral 
> three highlighted by several rectangles to appear as the number.
> 
> I want to show a countdown - yes I can do a countdown with a timer and 
> output the countdown in a label as in: 10 - 9 - 8 etc. - but this is 
> different.
> 
> What I would like to do is to run all these click events to show a 
> countdown.
> 
> So the click event for 8 has its own sequence of statements; the click 
> event for 7 has its own, etc.
> 
> I want a button to run the coding for each of these click events.
> 
> How do I do that?
> 
> Maggie
> _______________________________________________
> http://www.edulists.com.au - FAQ, resources, subscribe, unsubscribe
> Vbasic Mailing List kindly supported by
> http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment Authority and
> http://www.vitta.org.au  - VITTA Victorian Information Technology Teachers Association Inc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/vbasic/attachments/20100620/f096ee59/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 13491 bytes
Desc: not available
Url : http://www.edulists.com.au/pipermail/vbasic/attachments/20100620/f096ee59/attachment-0001.jpe 


More information about the vbasic mailing list