🖥️ Visual Basic Deleted

Status
Not open for further replies.
Not sure kung correct ito, pero parang ganito, icheck mo yung nakahighlight na lines:

[CODE lang="csharp" title="Code" highlight="7,22"]Option Explicit On
Option Strict On
Option Infer Off

Public Class Form1

Dim decItemPrice As Decimal


Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click

Const Tax As Decimal = 0.05D
Dim Shipping As Decimal = 6.5D
Dim decSubtotal As Decimal
Dim decSalesTax As Decimal
Dim decTotal As Decimal
Dim intCount As Integer

Decimal.TryParse(txtItemPrice.Text, decItemPrice)


decSubtotal = decSubtotal + decItemPrice
decSalesTax = decItemPrice * Tax
decTotal = decSubtotal + decSalesTax + Shipping

If (decSubtotal >= 100) Then
decTotal = decTotal - Shipping
Shipping = 0.0D
End If

lblSubtotal.Text = decSubtotal.ToString("c2")
lblSalesTax.Text = decSalesTax.ToString("c2")
lblShipping.Text = Shipping.ToString("c2")
lblTotal.Text = decTotal.ToString("c2")


End Sub

Private Sub txtItemPrice_Click(sender As Object, e As EventArgs) Handles txtItemPrice.Click

txtItemPrice.SelectAll()
End Sub

Private Sub txtItemPrice_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtItemPrice.KeyPress

If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back AndAlso e.KeyChar <> "." Then
e.Handled = True
End If
End Sub

Private Sub txtItemPrice_TextChanged(sender As Object, e As EventArgs) Handles txtItemPrice.TextChanged

lblSubtotal.Text = String.Empty
lblSalesTax.Text = String.Empty
lblShipping.Text = String.Empty
lblTotal.Text = String.Empty
End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class[/CODE]
 
Gumagana siya, katetesting ko lang. Input ka ng 20, click calculate. Tapos input ka ng 10, click calculate. HIndi ba ganun?
 
Status
Not open for further replies.

About this Thread

  • 10
    Replies
  • 410
    Views
  • 3
    Participants
Last reply from:
KlayThompson

Trending Topics

Online now

Members online
809
Guests online
1,426
Total visitors
2,235

Forum statistics

Threads
2,273,532
Posts
28,950,224
Members
1,235,804
Latest member
veno23
Back
Top