my challenge is to create a program to calculate the cost for a particular customer according to how many dogs they have to be washed.
1 dog = $10.00
2 Dogs = $17.00
3 or more Dogs = $17.00 (price for 2 dogs) + $5 for each additional dog.

i therefore have written the following code:
its not layed out correctly since i havent had time to fix it yet..please try and read through!


VB Code:
  1. Option Explicit
  2.  
  3. Private Sub cmdamountfordwc_Click()
  4. txtamountfordwc.Text = Format(txtcalculatedprice.Text * Val(0.05), "$0.00")
  5. End Sub
  6. Private Sub txtenterdognumber__KeyPress(KeyAscii As Integer)
  7.     If KeyAscii < 48 Or KeyAscii > 57 Then
  8.         Select Case KeyAscii
  9.             Case 8
  10.             Case Else
  11.                 KeyAscii = 0
  12.             End Select
  13.         End If
  14. End Sub
  15.  
  16. Private Sub cmdCalculateCharge_Click()
  17. If txtenterdognumber.Text >= 1 Then
  18. txtcalculatedprice.Text = Format(Val(10), "$0.00")
  19.  
  20.  
  21. End If
  22. If txtenterdognumber.Text >= 2 Then
  23. txtcalculatedprice.Text = Format(Val(17) + ((txtenterdognumber.Text - Val(2)) * Val(5)), "$0.00")
  24. End If
  25. If txtenterdognumber.Text = 0 Then
  26.     Beep
  27.     MsgBox "    PLEASE ENTER NUMBER OF DOGS    ", vbExclamation
  28.     txtcalculatedprice.Text = "0"
  29.     txtamountfordwc.Text = "0"
  30.    
  31.          
  32.     End If
  33. End Sub
  34.  
  35. Private Sub cmdclear_Click()
  36.     txtamountfordwc.Text = ""
  37.     txtcalculatedprice.Text = ""
  38.     txtenterdognumber.Text = ""
  39. End Sub
  40.  
  41. Private Sub cmdcountall_Click()
  42. Call cmdCalculateCharge_Click
  43. Call cmdamountfordwc_Click
  44. End Sub
  45.  
  46. Private Sub cmdexit_Click()
  47. End
  48. End Sub
  49. Private Sub txtcalculatedprice__KeyPress(KeyAscii As Integer)
  50.     If KeyAscii < 48 Or KeyAscii > 57 Then
  51.         Select Case KeyAscii
  52.             Case 8
  53.             Case Else
  54.                 KeyAscii = 0
  55.             End Select
  56.         End If
  57. End Sub
  58. Private Sub txtamountfordwc__KeyPress(KeyAscii As Integer)
  59.     If KeyAscii < 48 Or KeyAscii > 57 Then
  60.         Select Case KeyAscii
  61.             Case 8
  62.             Case Else
  63.                 KeyAscii = 0
  64.             End Select
  65.         End If
  66. End Sub
  67.  
  68. Private Sub txtenterdognumber_Change()
  69. If KeyAscii < 48 Or KeyAscii > 57 Then
  70.         Select Case KeyAscii
  71.             Case 8
  72.             Case Else
  73.                 KeyAscii = 0
  74.             End Select
  75.         End If
  76. End Sub


the problem is i have to stop it letting me enter letters into the box, or decimal points and multiple letters and to not let you type them in. as you can see i have tried to but it just doesnt want to work. what have i done wrong?