KlayThompson
Eternal Poster
- Joined
- Dec 1, 2020
- Posts
- 578
- Solutions
- 1
- Reaction
- 298
- Points
- 268
Bibigyan ko po ng 50php worth of Smartload ang makakasolve nitong problem nato. Ito po Visual basic programming activity po gusto ko lang sana malaman kung sana kung saan ako nagkulang.
Ito po yung problem:
Ito po yung UI:
Ito po yung code ko pero kulang po eh kasi isang beses lang sya nagtototal at ayaw ma-add sa next input ng user. (Check nyo nalang po yung problem sa taas para sa impormasyon).
Unang makakasolve po bibigyan ko ng 50php Smartload po. Salamat po!
Ito po yung problem:
Ito po yung UI:
Ito po yung code ko pero kulang po eh kasi isang beses lang sya nagtototal at ayaw ma-add sa next input ng user. (Check nyo nalang po yung problem sa taas para sa impormasyon).
Code:
Option Explicit On
Option Strict On
Option Infer Off
Public Class Form1
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 decItemPrice As Decimal
Dim intCount As Integer
Decimal.TryParse(txtItemPrice.Text, decItemPrice)
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
Unang makakasolve po bibigyan ko ng 50php Smartload po. Salamat po!
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.