Shane Partridge
Visual Basic 2013
The Code
Public Class Form35
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Phrase1, Phrase2, Phrase3 As String
Dim Position1, Position2, Position3 As Integer
Dim Retrieve1, Retrieve2, Retrieve3 As Integer
'## Reset Label1.ForeColor = Blue
Label1.ForeColor = Color.Blue
'## Error Handling [Try... Catch... End Try...] Structure
Try
Phrase1 = TextBox1.Text '## Assign Phrase1 to TextBox1 -------------------##
Phrase2 = TextBox2.Text '## Assign Phrase2 to TextBox2 -------------------##
Phrase3 = TextBox3.Text '## Assign Phrase3 to TextBox3 -------------------##
Position1 = TextBox4.Text '## Assign Position1 to TextBox4 ----------------##
Position2 = TextBox5.Text '## Assign Position2 to TextBox5 ----------------##
Position3 = TextBox6.Text '## Assign Position3 to TextBox6---------------- ##
Retrieve1 = TextBox7.Text '## Assign Retrieve1 to TextBox7 ------------------##
Retrieve2 = TextBox8.Text '## Assign Retrieve2 to TextBox8----------------- ##
Retrieve3 = TextBox9.Text '## Assign Retrieve3 to TextBox9 -----------------##
Label1.Text = Mid(Phrase1, Position1, Retrieve1) '## Label1 = Mid(Phrase, p, n) ---##
Label2.Text = Mid(Phrase2, Position2, Retrieve2) '## Label2 = Mid(Phrase, p, n) ---##
Label3.Text = Mid(Phrase3, Position3, Retrieve3) '## Label3 = Mid(Phrase, p, n) ---##
Catch Non_Input As Exception
'## NonInput Subroutine [1] ------------------------ ##
NonInput()
End Try
End Sub
'## Sub[1] -------------------------------------------------##
'## Error handling Routine ---------------------------------##
Sub NonInput()
Label1.ForeColor = Color.Red
Label1.Text = "Enter Value into all Input Boxes"
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Form33.Show()
Me.Hide()
End Sub
End Class