Notices
The Basement Non-Honda/Acura discussion. Content should be tasteful and "primetime" safe.

Any one good at Visual Basic??

Thread Tools
 
Old Mar 8, 2003 | 02:25 PM
  #11  
Cyclonus's Avatar
Cyclonus
UP AND ADD THEM
 
Joined: Mar 2002
Posts: 1,559
Likes: 0
From: Texas
Default

you're
Reply
Old Mar 8, 2003 | 02:26 PM
  #12  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Reply
Old Mar 11, 2003 | 07:21 PM
  #13  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default Suggestions are needed

Maybe i should jus toss it in the can, anywho, i am having a little trouble on how to get this part of my program to work, as usual.

This is the situation. I have a frame box which consists of 5 chkboxes. My question is how exactally would i go about adding each of the different chkbox values when they are checked

For instance:
(Bagel toppings)

Cream Cheese (.$50)
Butter ($.25)
Blueberry jam ($.75)
Raspberry jam ($.75)
Peach jelly ($.75)

If i click on any one or two or all of the following, how would i go about adding that value to my subtotal on my bill?

I really do appreciate all the help, it has helped me understand this stuff a lot better. Thanks

Greg
Reply
Old Mar 12, 2003 | 02:59 AM
  #14  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

:thumbup:
Reply
Old Mar 12, 2003 | 04:41 AM
  #15  
Skelly_GSR's Avatar
Skelly_GSR
RB does men
 
Joined: Jan 2003
Posts: 11,997
Likes: 0
From: Pittsburgh
Default

Im taking that course in school right now. Soo fawking lost
Reply
Old Mar 12, 2003 | 04:12 PM
  #16  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Originally posted by Skelly_GSR
Im taking that course in school right now. Soo fawking lost
u 2 ??? bump it
Reply
Old Mar 12, 2003 | 04:58 PM
  #17  
swaggs21's Avatar
swaggs21
 
Joined: Dec 2002
Posts: 5,747
Likes: 0
From: Lumberport, WV
Default

If you guys ever need any help, just im me on AIM, and I am willing to help any time, I may not check the post all the time so just im me. And to make sure I know what I am talking about, I have 7 Microsoft Certifications, including an MCSD .Net
Reply
Old Mar 12, 2003 | 07:00 PM
  #18  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Option Explicit
Dim bagel_total, toppings, subTotal, total_tax, total_bill As Double
Const tax = 0.06
Const x = 25


Private Sub cmdCalc_Click()

'Bagel and Coffee Selection
If (optWhite = True) Then
If (optNone = True) Then
bagel_total = 1.25
End If
End If
If (optWhite = True) Then
If (optRegular = True) Then
bagel_total = 2.5
End If
End If
If (optWhite = True) Then
If (optCapp = True) Then
bagel_total = 3.25
End If
End If
If (optWhite = True) Then
If (optCafe = True) Then
bagel_total = 3
End If
End If

If (optWheat = True) Then
If (optNone = True) Then
bagel_total = 1.5
End If
End If
If (optWheat = True) Then
If (optRegular = True) Then
bagel_total = 2.75
End If
End If
If (optWheat = True) Then
If (optCapp = True) Then
bagel_total = 3.5
End If
End If
If (optWheat = True) Then
If (optCafe = True) Then
bagel_total = 3.75
End If
End If

'Toppings
If (chkCheese = vbChecked) Then
toppings = toppings + 0.5
End If
If (chkButter = vbChecked) Then
toppings = toppings + 0.25
End If
If (chkBlue = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkRasp = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkPeach = vbChecked) Then
toppings = toppings + 0.75
End If

subTotal = bagel_total + toppings
total_tax = subTotal * tax
total_bill = subTotal + total_tax

lblSubtotal.Caption = FormatCurrency(subTotal)
lblTax.Caption = FormatCurrency(total_tax)
lblTotal.Caption = FormatCurrency(total_bill)

picResult.Cls
picResult.FontBold = True
picResult.Print "Customer Reciept"
picResult.FontBold = False
picResult.Print
picResult.Print "Subtotal: "; Tab(x); FormatCurrency(subTotal)
picResult.Print "Tax: "; Tab(x); FormatCurrency(total_tax)
picResult.Print "Total: "; Tab(x); FormatCurrency(total_bill)

End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdPayment_Click()
Dim payment, cashDue As Single
payment = Val(InputBox("Enter the Pament", "Payment", FormatNumber(total_bill, 2)))

If (payment < total_bill) Then
MsgBox "Incorrect Amount!", vbOKOnly + vbCritical, "Error!"
Else
cashDue = payment - total_bill
picResult.Print "Payment"; Tab(x); FormatCurrency(payment)
picResult.Print "Change Due"; Tab(x); FormatCurrency(cashDue)
End If
End Sub
Reply
Old Mar 16, 2003 | 06:50 AM
  #19  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Ok, this is the only thing that is stopping my program from running perfrect:

'Toppings
If (chkCheese = vbChecked) Then
toppings = toppings + 0.5
End If
If (chkButter = vbChecked) Then
toppings = toppings + 0.25
End If
If (chkBlue = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkRasp = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkPeach = vbChecked) Then
toppings = toppings + 0.75
End If

subTotal = bagel_total + toppings
total_tax = subTotal * tax
total_bill = subTotal + total_tax

everytime the calc button is hit with any of the chk boxes checked, it will add the total of what the chk boxes are to the subTotal/total_tax/total_bill every single time you hit the Calc button. Any idea of how to stop this from happening?

Thanks for the help.
Greg
Reply
Old Apr 13, 2003 | 12:41 PM
  #20  
hondav6's Avatar
hondav6
Thread Starter
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Private Sub cmdCalc_Click()
Dim cost, down_payment, months, years, loan_amount, percent_down As Integer


cost = Val(txtCost.Text)
down_payment = Val(txtDP.Text)
months = Val(txtMonths.Text)
years = months / 12
loan_amount = cost - down_payment
percent_down = Val(txtDP.Text / loan_amount)

lblLoanAmt.Caption = Format(loan_amount, "currency")

If optNew Then
ir = 0.089
Else
ir = 0.095
End If
lblAnnual.Caption = Format(ir, "percent")

If cost > 25000 Then
MsgBox "Incorrect Vehicle Cost!" + vbCr + "Must be less than $25,000 vbCritical"
txtCost.Text = ""
txtCost.SetFocus
Exit Sub
End If

If down_payment < cost * 0.05 Then
MsgBox "Must provide 5% down!" + vbCr + "Before loan can be approaved"
txtDP.Text = ""
txtDP.SetFocus
Exit Sub
End If

If months < 6 Or months > 48 Then
MsgBox "Incorrect Months!" + vbCr + "Must be between 6 and 48 months"
txtMonths.Text = ""
txtMonths.SetFocus
Exit Sub
End If

For i = 0 To 11
lblPayment(i).Caption = ""
lblPrincipal(i).Caption = ""
lblIR(i).Caption = ""
Payment = Pmt(ir / 12 / 1, months, -loan_amount)
lblPayment(i).Caption = FormatCurrency(Payment)
Principle = PPmt(ir / 12, 1, months, -loan_amount)
lblPrincipal(i).Caption = FormatCurrency(Principle)
Interest = IPmt(ir / 12, 1, months, -loan_amount)
lblIR(i).Caption = FormatCurrency(Interest)
Next i
End Sub
Reply



All times are GMT -8. The time now is 12:04 AM.