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

Graeme Summers graemebs at bigpond.net.au
Mon Jun 21 21:33:34 EST 2010


Maggie,

Here's an extended solution using two digits contained in group boxes and the starting number selected with a numeric updown:



Public Class Form1

    Private Num As Integer = 99

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

        Dim obj As Object

        Dim TensDigit As Integer = Num \ 10

        Dim UnitsDigit As Integer = Num Mod 10

        For Each obj In grpTens.Controls

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

        Next

        For Each obj In grpUnits.Controls

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

        Next

        Num -= 1

        If Num < 0 Then

            tmrCount.Stop()

            updStartNum.Value = 99

        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



    Private Sub updStartNum_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updStartNum.ValueChanged

        Num = updStartNum.Value

    End Sub

End Class



regards,

Graeme




----- 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/20100621/65a5a68a/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 19100 bytes
Desc: not available
Url : http://www.edulists.com.au/pipermail/vbasic/attachments/20100621/65a5a68a/attachment-0001.jpe 


More information about the vbasic mailing list