0% found this document useful (0 votes)
14 views

LAB TASK 2 update

LAB TASK

Uploaded by

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

LAB TASK 2 update

LAB TASK

Uploaded by

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

Public Class Form1

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

End Sub

Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles


btnDisplay.Click
Dim lblHour, lblCost, laborCost, totalPartsCost, totalCost As Double
Dim lblCustName As String
Const laborHourCost As Integer = 35
Const tax As Double = 0.05

If (IsNumeric(txtHour.Text) And IsNumeric(txtCost.Text) And txtName.Text <>


"") Then
lblHour = CDbl(txtHour.Text)
lblCost = CDbl(txtCost.Text)
lblCustName = txtName.Text

laborCost = lblHour * laborHourCost


totalPartsCost = lblCost + (lblCost * tax)
totalCost = laborCost + totalPartsCost

lstDisplay.Items.Add("Customer: " & lblCustName)


lstDisplay.Items.Add("Labor Cost: RM " & laborCost)
lstDisplay.Items.Add("Parts Cost: RM " & totalPartsCost)
lstDisplay.Items.Add("Total Cost: RM " & totalCost)

Else
MsgBox("Please enter valid data")

End If
End Sub

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


btnQuit.Click
Me.Close()
End Sub

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


btnReset.Click
txtName.Text = ""
txtHour.Text = ""
txtCost.Text = ""
lstDisplay.Items.Clear()
End Sub
End Class

Public Class Form1


Private Sub btnoverflow_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles btnoverflow.Click
Dim jaw As Short

Try

jaw = Val(txtnum1.Text) + Val(txtnum2.Text)


MessageBox.Show(jaw)

Catch When Err.Number

MessageBox.Show(Err.Description)

End Try
End Sub

Private Sub btnzero_Click(ByVal sender As Object, ByVal e As EventArgs) Handles


btnzero.Click
Try

Dim a, b, c As Integer

a = 3

b = 0

c = a Mod b

Catch When Err.Number

MessageBox.Show(Err.Description & "Try again", "ERROR")

End Try
End Sub
End Class

If Not IsNothing(Me.txtIC.Text) Then


Me.EP1.SetError(Me.txtIC, "Please enter some values")
Return
Else
MessageBox.Show("Accepted")
End If

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy