Software Sales Application help

Page 1 of 1

2 Replies - 289 Views - Last Post: 18 October 2017 - 11:41 PM Rate Topic: -----

#1 Ironxlotus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-October 17

Software Sales Application help

Posted 18 October 2017 - 07:42 PM

my question is how do I get the grand to display on the message box?
I already got it to display Pack A, Pack B, and Pack C but the grand shows up as Grand $O

I just started doing this so please be nice and I do appreciate all the help!

Dim PackA As Single
Dim PackB As Single
Dim PackC As Single
Dim TotalA As Decimal
Dim TotalB As Decimal
Dim TotalC As Decimal
Dim Grand As Decimal
Dim PriceA As Decimal
Dim Discount As Decimal
Dim PercentA As Decimal
Dim PercentB As Decimal
Dim PercentC As Decimal
Dim PercentD As Decimal

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
txtPackA.Clear()
txtPackB.Clear()
txtPackC.Clear()
chkGrand.Checked = False

End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
PercentA = 0.2
PercentB = 0.3
PercentC = 0.4
PercentD = 0.5
PackA = Val(txtPackA.Text) * 99
PackB = Val(txtPackB.Text) * 199
PackC = Val(txtPackC.Text) * 299


Select Case PackA
Case Is < 10
Discount = Val(txtPackA.Text) * 99
TotalA = Discount - PercentA
Case 10 To 19
Discount = ((Val(txtPackA.Text) * 99) * PercentB)
TotalA = Discount - PercentB
Case 20 To 50
Discount = ((Val(txtPackA.Text) * 99) * PercentC)
TotalA = Discount - PercentC
Case 51 To 100
Discount = ((Val(txtPackA.Text) * 99) * PercentD)
TotalA = Discount - PercentD
End Select
Select Case PackB
Case Is < 10
Discount = Val(txtPackB.Text) * 99
TotalA = Discount - PercentA
Case 10 To 19
Discount = ((Val(txtPackB.Text) * 99) * PercentB)
TotalA = Discount - PercentB
Case 20 To 50
Discount = ((Val(txtPackB.Text) * 99) * PercentC)
TotalA = Discount - PercentC
Case 51 To 100
Discount = ((Val(txtPackB.Text) * 99) * PercentD)
TotalA = Discount - PercentD
End Select
Select Case PackC
Case Is < 10
Discount = Val(txtPackC.Text) * 99
TotalA = Discount - PercentA
Case 10 To 19
Discount = ((Val(txtPackC.Text) * 99) * PercentB)
TotalA = Discount - PercentB
Case 20 To 50
Discount = ((Val(txtPackC.Text) * 99) * PercentC)
TotalA = Discount - PercentC
Case 51 To 100
Discount = ((Val(txtPackC.Text) * 99) * PercentD)
TotalA = Discount - PercentD

Grand = TotalA + TotalB + TotalC
End Select


If chkGrand.Checked = False Then
MessageBox.Show("Package A: $" & PackA &
ControlChars.CrLf & "Package B: $" & PackB &
ControlChars.CrLf & "Package C: $" & PackC &
ControlChars.CrLf & "Grand $" & Grand)
Else : MessageBox.Show("Grand : $" & Grand)




End If


End Sub
End Class

Is This A Good Question/Topic? 0
  • +

Replies To: Software Sales Application help

#2 jimzcoder  Icon User is offline

  • D.I.C Regular

Reputation: 57
  • View blog
  • Posts: 351
  • Joined: 14-November 12

Re: Software Sales Application help

Posted 18 October 2017 - 10:35 PM

Hi, by reading reading your code, it seems the problem is on your conversion of textbox value. Try using CDec(textbox.text) to convert the text into decimal datatype instead of val because Val() function converts it to integer data type if i`m not mistaken. Hope it helps :)
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,772
  • Joined: 12-December 12

Re: Software Sales Application help

Posted 18 October 2017 - 11:41 PM

Do not create duplicate posts, closing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1