VB Exercise 4.8 - Handles btnCalculate.Click Dim MdSpeed As...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Exercise 4-8 ….”One Nation Under GOD” . ...and you can interpret god to be anything you choose. I finished this exercise 4-8 yesterday. It took me this long to get it into the Blog. Start The Program Source Code Imports Microsoft.VisualBasic.ControlChars 'Allows shortened control Character statements Public Class Form1 Const SpdAir As Decimal = 1100 'Sound Speed in Air (Feet/Sec) Const spdWater As Decimal = 4900 'Sound Speed in Water (Feet/Sec) Const spdSteel As Decimal = 16400 'Sound Speed in Steel (Feet/Sec) Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() 'Stop snd Close the Program End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click txtDistance.Clear() 'Clear The Distance Text Box lblTrvlTime.Text = "" 'Clear the Answer Box txtDistance.Focus() End Sub Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Handles btnCalculate.Click Dim MdSpeed As Decimal Dim wvTravelDist As Decimal Try wvTravelDist = CDec(txtDistance.Text) 'TextBox entry is a Number Catch ex As Exception MessageBox.Show("You Must Enter a Number" & CrLf & "For The Distance" & _ CrLf & "The Sound Traveled.", "Input Error!") End Try If txtDistance.Text <= 0 Then 'TextBox lessThan 0 MessageBox.Show("Distance Traveled" & CrLf & _ "Can Not Be Zero or Less Than Zero " & CrLf & CrLf & _ "Please Try again!", "Input Error - Distance Traveled!") End If If rdoAir.Checked Then MdSpeed = SpdAir ElseIf rdoWater.Checked Then MdSpeed = spdWater ElseIf rdoSteel.Checked Then MdSpeed = spdSteel Else MessageBox.Show("You Must Select A Medium", "Input Error!") End If lblTrvlTime.Text = FormatNumber((wvTravelDist / MdSpeed), 3) & " Seconds" End Sub End Class End The Program Source Code Extensive Editing was necessaryonce I loaded it into the Blog....
View Full Document

This note was uploaded on 10/23/2011 for the course COP 1332 taught by Professor Ryland during the Spring '11 term at American College of Computer & Information Sciences.

Page1 / 2

VB Exercise 4.8 - Handles btnCalculate.Click Dim MdSpeed As...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online