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 (138,520)

   In Properties Windows set Size to (701,112)

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.

The Timer1 Initiates the Program Cycles at 0.1 Seconds Per Cycle.

The Sub Procedure - Generate() Assigns a Random Numeric Value to crackpass Variable for Testing.

The Sub Procedure - CountListBox() counts the number of Cycles and lists each Individual Random

Number until the Random Numeric Variable (crackpass) matches the password (123).

The Sub Routines are displayed as Sub Generate()

                                          and Sub CountListBox()

As with each Cycle Generated by Private Sub Timer1_Tick

The Program Flow revert back and Forth between the Sub Procedure Routines.

Quantifying the Variables in the Process.

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-89.jpg
Website Links-173.jpg

The Code

Public Class Form60

    'Dimension Variables as Integer Value
    Dim password As Integer
    Dim
crackpass As Integer
    Dim
Count As Integer

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

        'Generate() - Initiates Goto Sub Gernerate() Command 
        generate()

        'Sub Procedure() Count & ListBox1 
        CountListBox()

        'Test Value of crackpass against password 
        If crackpass = password Then
            Timer1.Enabled = False
           
Label1.Text = crackpass
            Label2.Text = "Password Cracked!Login Successful!"

            'Else continue Cycling  
        Else :
Label1.Text = crackpass
            Label2.Text = "Please wait..."

        End If

    End Sub

    Sub generate()

       'Random Values assigned to crackpass 
        crackpass = Int(Rnd() * 100) + 100

    End Sub

    Sub CountListBox()

        'Count Variable displays No. of Cycles to Crack Password
        Count = (Count + 1) : Label3.Text = Count


        'Display each Random Value into ListBox1 
        ListBox1.Items.Add(
Count & "  -  " & crackpass)

    End Sub

    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 Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        'Clear ListBox, Labels & Variables for Re-Calculus.
        ListBox1.Items.Clear()
       
Label1.Text = ""
       
Label2.Text = ""
       
Label3.Text = ""
       
Count = 0

    End Sub

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

        Form57.Show()
        Me.Hide()

    End Sub

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

        'Assign Numerical Password to Variable
        password = 123

    End Sub


End Class

bottom of page