0% found this document useful (0 votes)
37 views6 pages

Form1 Object Eventargs: 'Noah Alderman, 3/9/16, Chapter3 Exercise1

This document contains code for multiple Visual Basic .NET exercises completed by Noah Alderman on various dates from March 9, 2016 to April 5, 2016. The code includes event handlers, variables, calculations, and controls for user interfaces to convert between units, calculate areas/perimeters, determine coin amounts from a total, and display text based on radio button selection in different languages.

Uploaded by

api-307845805
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views6 pages

Form1 Object Eventargs: 'Noah Alderman, 3/9/16, Chapter3 Exercise1

This document contains code for multiple Visual Basic .NET exercises completed by Noah Alderman on various dates from March 9, 2016 to April 5, 2016. The code includes event handlers, variables, calculations, and controls for user interfaces to convert between units, calculate areas/perimeters, determine coin amounts from a total, and display text based on radio button selection in different languages.

Uploaded by

api-307845805
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Public Class Form1

'Noah Alderman, 3/9/16, Chapter3 Exercise1


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub lblQuestion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Time.Click
End Sub
Private Sub btnAnswer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btnAnswer.Click
Dim height As Double
Dim Time As Double
Time = Val(Me.txtSide.Text)
height = 100 - ((Time * Time) * 4.9)
Me.lblAnswer.Text = height
End Sub
End Class
Public Class Form1
'Noah Alderman, 3/30/16 Chapter3 Exercise2a
Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnAnswer.Click
Dim Fahren As Integer
Dim Cel As Integer
Fahren = Val(Me.TextBox1.Text)
Cel = 5 / 9 * (Fahren - 32)
Me.lblAnswer.Text = Cel
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub lblAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles lblAnswer.Click
End Sub
End Class

Public Class Form1

'Noah Alderman,3/30/16 Chapter3 Exercise2b


Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Fahren As Integer
Dim Cel As Integer
Fahren = Val(Me.TextBox1.Text)
Cel = 5 / 9 * (Fahren - 32)
Me.lblAnswer.Text = Cel
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub lblAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles lblAnswer.Click
End Sub
Private Sub FahrenheitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles FahrenheitToolStripMenuItem.Click
Dim Fahren As Integer
Dim Cel As Integer
Cel = Val(Me.TextBox1.Text)
Fahren = 5 / 9 * (Cel + 32)
Me.lblAnswer.Text = Fahren
End Sub
Private Sub CelsiusToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CelsiusToolStripMenuItem.Click
Dim Fahren As Integer
Dim Cel As Integer
Fahren = Val(Me.TextBox1.Text)
Cel = 5 / 9 * (Fahren - 32)
Me.lblAnswer.Text = Cel
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub
End Class

Public Class Form1


'Noah Alderman, 3/30/16 Chapter3 Excercise3

Private Sub btnExpression_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnExpression.Click
Dim width As Integer
'side of rectangle'
Dim Length As Integer
Dim area As Integer
Dim Perimeter As Integer
Length = Val(Me.TextBox1.Text)
width = Val(Me.TextBox2.Text)
area = width * Length
Perimeter = width + width + Length + Length
Me.lblAnswer1.Text = area
'display Answer'
Me.lblAnswer2.Text = Perimeter 'display Answer'
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub
End Class
Public Class Form1
'Noah Alderman, 3/31/16 Chapter3 Exercise4'
Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnAnswer.Click
Dim Labor As Single
Dim Rent As Single
Dim Materials As Single
Dim Size As Single
Dim Cost As Single
Size = Val(TextBox1.Text)
Labor = 0.75
Rent = 1.0
Materials = (Size * 0.05) * Size
Cost = Rent + Labor + Materials
Me.lblAnswer.Text = Cost
End Sub
End Class

Public Class Form1


'Noah Alderman, 3/31/16 Chapter3 Exercise5'

Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnAnswer.Click
Dim m As Double
'Mass'
Dim Joules As Double '360000 joules is needed to light one 100w bulb'
Dim Bulb As Double
m = Val(Me.TextBox1.Text)
Joules = m * (3 * 10 ^ 8) * (3.0 * 10 ^ 2)
Bulb = m * ((3 * 10 ^ 8) ^ 2) / 360000
Me.lblAnswer.Text = Joules
Me.lblAnswer2.Text = Bulb
End Sub
End Class
Public Class Form1
'Noah Alderman, 4/1/16 Chapter3 Exercise6
Private Sub ExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub
Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnAnswer.Click
Dim a As Double = Val(TextBox1.Text)
Dim b As Double = Val(TextBox2.Text)
Dim c As Double = Val(TextBox3.Text)
Dim d As Double = Val(TextBox4.Text)
Me.lblAnswer.Text = (a + b + c + d) / 4
End Sub
End Class
Public Class Form1
'Noah Alderman, 4/1/16 Chapter3 Exercise 7'
Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnAnswer.Click
Dim Quarters As Decimal
Dim Dimes As Decimal
Dim Nickels As Decimal
Dim Pennies As Decimal
Dim Coins As Decimal
Coins = Val(TextBox1.Text)
Quarters = Coins \ 25
Dimes = (Coins Mod 25) \ 10
Nickels = ((Coins Mod 25) Mod 10) \ 5
Pennies = (((Coins Mod 25) Mod 10) Mod 5) \ 1
Me.lblAnswer.Text = Quarters
Me.lblAnswer2.Text = Dimes
Me.lblAnswer3.Text = Nickels
Me.lblAnswer4.Text = Pennies
End Sub
End Class
Public Class Form1
'Noah Alderman, 4/1/16 Chapter3 Exercise 8 a.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim Digit As Integer
Dim First As Integer
Dim Second As Integer
Digit = Val(Me.TextBox1.Text)
First = Digit \ 10
Second = (Digit Mod 10)
Me.lblAnswer.Text = First
Me.lblAnswer2.Text = Second
End Sub
End Class

Public Class Form1


'Noah Alderman, 4/1/16 Chapter3 Exercise 8 b.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim Digit As Integer
Dim First As Integer
Dim Second As Integer
Digit = Val(Me.TextBox1.Text)
First = Digit \ 10
Second = (Digit Mod 10)
Me.lblAnswer.Text = First
Me.lblAnswer2.Text = Second
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub
Private Sub DigitsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DigitsToolStripMenuItem.Click
Dim Digit As Integer
Dim First As Integer
Dim Second As Integer
Digit = Val(Me.TextBox1.Text)
First = Digit \ 10
Second = (Digit Mod 10)
Me.lblAnswer.Text = First
Me.lblAnswer2.Text = Second
End Sub
End Class
Public Class Form1
'Noah Alderman, 4/5/16 Chapter3 Exercise 9'

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles RadioButton2.CheckedChanged
Dim Minutes As Decimal
Dim Hours As Decimal
Hours = Val(Me.TextBox1.Text) \ 60
Minutes = ((Val(Me.TextBox1.Text) Mod 60))
Me.lblAnswer.Text = Hours
Me.lblAnswer2.Text = Minutes
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged
Dim Minutes As Decimal
Dim Seconds As Decimal
Minutes = Val(Me.TextBox1.Text)
Seconds = Val(Me.TextBox1.Text) * 60
Me.lblAnswer.Text = Seconds
Me.lblAnswer2.Text = Seconds
End Sub
End Class
Public Class Form1
'Noah Alderman, 4/5/16 Chapter3 Exercise 10'
Private Sub radEnglish_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles radEnglish.CheckedChanged
Me.Label1.Text = "My Name is"
End Sub
Private Sub radFrench_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles radFrench.CheckedChanged
Me.Label1.Text = "Mi nombre es"
End Sub
Private Sub radSpanish_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles radSpanish.CheckedChanged
Me.Label1.Text = "Mon nom est"
End Sub
End Class

You might also like