top of page

Visual Basic - An Event Driven Programming Language

Building the GUI-Based Programming Language

by Inserting Controls from the Tool Box.

1. Right Click on Graphics Image : Then Press Save Image as to Folder

      - The Graphics Chart above corresponds to the Tool Box Controls

      - Making Graphic User Interface [GUI] Easier to Build.

2. Copy Coding onto Forms VB for Program Execution.

3. In VB Design Mode : Drag Picture Box from Tool Box.

   In Properties Window - Set VB Design Form to Size (1069.805)

   In Properties Window - Set Picture Box Size to (1012,726)

4. Drag Timer from Tool Box -  In Properties set Timer to (100) = 0.1 Second

5. Drag ListBox from Tool Box 

   In Properties Windows set Location to (63,484)

   In Properties Windows set Size to (893,188)

6. Set Picture Box Size Mode to Stretch Image.

   

7. Download Graphic Image below from allocated Folder.

In Private Sub Button_3 if only 1 Form is being used.

Terminate Form57.Show()

               Me.Hide()

Then add  Me.Close()   ' To Close Program.

Follow and Insert the LabelBoxButton & ListBox Controls from ToolBox

and allocate them on the Graphics Template Chart.

The Program Tests the Random Values (crackpass) against (password Value)

Initiated the the Sub Procedure Generate().

The Program Counts the number of Cycling unil (crackpass = password)

Button1 Initiates the Timer sequence  - Timer1.Enabled = True

In Form VB Design Mode - Double Click on Timer1 to open the VB Code.

Copy the Code below in between Private Sub Timer1_Tick 

                                               and

                                               End Sub

Then paste Code onto the VB Code Form.

Then proceed as usual in copying Button1, Button2 and Button3 in their Sub defined Routines.

Similar to earlier Computer Languages

the Sub Procedure acts like a Gosub Routine.

returning control from whence it was called from.

      

Visual Basic 2013 Adobe-91.jpg
Website Links-173.jpg

 Examples of Sub Routines and Nested Sub Routines Configurations. 

 Timer Function incorporating a Triple (CrackPass If... Test.. Then Function) Sub Procedures incorporated   with Nested Sub Procedures to Assign Values to Variables.

 When each Cycle is completed Button2 Clears Variables for Re calculus.

 The Program can be repeated by Pressing Button1.

 The Timer Function Interval is set to 100 = (0.1) equates to 10th Second Cycle Rate.

 As each Random Cycle CrackPass is completed. The Nested Sub Procedure CountCycle records and   Numerically quantifies each CrackPass Test. 

 Each Test is Numerically evaluated in the ListBox1.Items.Add()

The Code

Public Class Form61

    '## (Dimension Variables for Calculus) ##
    Dim
Random1 As Integer
    Dim
Random2 As Integer
    Dim
Random3 As Integer
    Dim
CrackPass As Integer
    Dim
CountListBoxCycle As Integer

    Dim Count1 As Integer
    Dim
Count2 As Integer
    Dim
Count3 As Integer

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        '## (Button1 enables Timer : Timer1.Enabled = True)
        Timer1.Enabled = True

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        '## (Timer1_Tick Subroutine) ##

        '## (Sub Procedure - Assign Random Values) ##
        '## (Total Sub Procedures = 11) ##
        '## (Total Nested Sub Procedures = 4) ##

        'Sub Routine(1)
        Random1Value()


        'Sub Routine(2)
        Random2Value()


        'Sub Routine(3)
        Random3Value()


        'Sub Routine(4)
        CountListBox()

        '## (Test Random Values against CrackPass) ##


        If Random1 = CrackPass Then
            Timer1.Enabled = False
           
'Sub Routine(5)
            LabelValue1()

        ElseIf Random2 = CrackPass Then
            Timer1.Enabled = False
           
'Sub Routine(6)
            LabelValue2()

        ElseIf Random3 = CrackPass Then
            Timer1.Enabled = False
           
'Sub Routine(7)
            LabelValue3()

        End If


    End Sub

    '## (Sub Procedure Assigning Random Value to Variables) ##

    'Sub(1)
    Sub Random1Value()
       
Random1 = Int(Rnd() * 100)
    End Sub

    'Sub(2)
    Sub Random2Value()
       
Random2 = Int(Rnd() * 100)
    End Sub

    'Sub(3)
    Sub Random3Value()
       
Random3 = Int(Rnd() * 100)
    End Sub

    '## (Sub Procedure Assigning Values to ListBox1 & Count Variable) ##


    'Sub(4)
    Sub CountListBox()

        '## (Nested Sub Procedure - Count ListBox1Cycling) ##

        'Sub(8)
        ListBox1Cycling()
        ListBox1.Items.Add(" (" &
CountListBoxCycle & "    -    " & Random1 & "          -          " & Random2 & "          -          " & Random3 & ")")

    End Sub

    '## (Sub Procedure Assigning Variables to Label1.Text) ##
    'Sub(5)

    Sub LabelValue1()
       
Label1.Text = "Random1 = " & Random1

        '## [Nested Sub Procedure CountCycle1() ] ##

        'Sub(9)
        CountCycle1()

    End Sub

    'Sub(6)
    Sub LabelValue2()
       
Label1.Text = "Random2 = " & Random2

        '## [Nested Sub Procedure CountCycle2() ] ##

        'Sub(10)
        CountCycle2()

    End Sub

    'Sub(7)
    Sub LabelValue3()
       
Label1.Text = "Random3 = " & Random3

        '## [Nested Sub Procedure CountCycle3() ] ##

        'Sub(11)
        CountCycle3()

    End Sub

    '## (Sub Procedure - Count Cycling when Random Value = Limit Value) ##

    'Sub(9)
    Sub CountCycle1()
       
Count1 = (Count1 + 1) : Label2.Text = Count1
    End Sub

    'Sub(10)
    Sub CountCycle2()
       
Count2 = (Count2 + 1) : Label3.Text = Count2
    End Sub

    'Sub(11)
    Sub CountCycle3()
       
Count3 = (Count3 + 1) : Label4.Text = Count3
    End Sub

    '## [Nested Sub Procedure - ListBoxCycling()] ## 

    'Sub(8)
    Sub ListBox1Cycling()
       
CountListBoxCycle = (CountListBoxCycle + 1)
       
Label1.Text = CountListBoxCycle
        Label5.Text = "No Cycles = " & CountListBoxCycle
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        '## (Button2_Click - Clear ListBox1 & Variables) ##
        ListBox1.Items.Clear()
       
Label1.Text = ""
       
Label5.Text = ""
       
CountListBoxCycle = 0

    End Sub


    Private Sub Form61_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        '## (Assign Value to CrackPass) ##
        CrackPass = 95

        '## (Clear Variables when Initiating Program) ##
        Label1.Text = ""
       
Label2.Text = ""
       
Label3.Text = ""
       
Label4.Text = ""
       
Label5.Text = ""

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


        Form57.Show()
        Me.Hide()


    End Sub


End Class


 

bottom of page