Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27027

Visual Basic 2010 help

$
0
0
Hello!

I was wondering if you guys could help with me a visual basic assignment that I've been stuck on.

Its for my cosci 103 class. It is Assignment 4.1 and 4.1 on Programming in Visual Basic 2010.

I basically have everything working, but when I test it out during debug, my "Next Patron" button opens a new window asking to clear all fields, and when I click "yes" its supposed to... but it doesnt. I'm not really sure why...

I've been taking this class online, and there literally are no lectures, and our professor just expects us to submit assignments without any aid.

Below is the code. Im sorry in advance if its really unorganized/messy. I'm not a computer science major or anywhere near that field....
I'd really appreciate it if you guys could help.

Thanks in advance!


Public Class ImageConsultingForm
'Declare module-level constants.

Const TENPERCENTDISCOUNT_RATE_Decimal As Decimal = 0.1D
Const TWENTYPERCENTDISCOUNT_RATE_Decimal As Decimal = 0.2D
Const MAKEOVER_PRICE_Decimal As Decimal = 125D
Const MANICURE_PRICE_Decimal As Decimal = 35D
Const PERMANENTMAKEUP_PRICE_Decimal As Decimal = 200D
Const HAIRSTYLING_PRICE_Decimal As Decimal = 60D

' Declare module-level wariables for summary information.
Private DiscountRateDecimal, SubtotalDecimal, TotalDecimal, DiscountSumDecimal As Decimal

Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
' Calculate and display the current amounts and add to totals.
Dim DiscountRateDecimal, MakeoverPriceDecimal, HairStylingPriceDecimal, ManicurePriceDecimal, PermanentMakeupPriceDecimal As Decimal

' Find the price.
If MakeoverRadioButton.Checked Then
MakeoverPriceDecimal = MAKEOVER_PRICE_Decimal
ElseIf HairStylingRadioButton.Checked Then
HairStylingPriceDecimal = HAIRSTYLING_PRICE_Decimal
ElseIf ManicureRadioButton.Checked Then
ManicurePriceDecimal = MANICURE_PRICE_Decimal
ElseIf PermanentMakeupRadioButton.Checked Then
PermanentMakeupPriceDecimal = PERMANENTMAKEUP_PRICE_Decimal

End If
'calculate subtotal of all services
Try
SubtotalDecimal += MakeoverPriceDecimal + HairStylingPriceDecimal + ManicurePriceDecimal + PermanentMakeupPriceDecimal
Catch
End Try
'calculate subtotal values.


If TenPercentRadioButton.Checked Then
DiscountRateDecimal = SubtotalDecimal * TENPERCENTDISCOUNT_RATE_Decimal
ElseIf TwentyPercentRadioButton.Checked Then
DiscountRateDecimal = SubtotalDecimal * TWENTYPERCENTDISCOUNT_RATE_Decimal
End If

'format and display summary values.


'Calculate extended price and add to order total.
Try

TotalDecimal += SubtotalDecimal - DiscountRateDecimal
SubtotalTextBox2.Text = SubtotalDecimal.ToString("C")
DiscountRateTextBox1.Text = DiscountRateDecimal.ToString("C")
TotalTextBox.Text = TotalDecimal.ToString("C")

' allow clear after an order is begun
ClearButton.Enabled = True
TenPercentRadioButton.Enabled = True
TwentyPercentRadioButton.Enabled = True

Catch ex As Exception

End Try

End Sub

Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
'Clear the appropriate controls
MakeoverAmountTextBox1.Clear()
HairStylingAmountTextBox.Clear()
ManicureCostTextBox.Clear()
PermanentMakeupCostTextBox.Clear()
SubtotalTextBox2.Clear()
DiscountRateTextBox1.Clear()
With TotalTextBox
.Clear()
.Focus()
End With

End Sub


Private Sub MakeoverRadioButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MakeoverRadioButton.Click
MakeoverAmountTextBox1.Text = MAKEOVER_PRICE_Decimal.ToString("C")
End Sub

Private Sub HairStylingRadioButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles HairStylingRadioButton.Click
HairStylingAmountTextBox.Text = HAIRSTYLING_PRICE_Decimal.ToString("C")
End Sub

Private Sub ManicureRadioButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ManicureRadioButton.Click
ManicureCostTextBox.Text = MANICURE_PRICE_Decimal.ToString("C")
End Sub

Private Sub PermanentMakeupRadioButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PermanentMakeupRadioButton.Click
PermanentMakeupCostTextBox.Text = PERMANENTMAKEUP_PRICE_Decimal.ToString("C")
End Sub

Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub

Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub

Private Sub NextPatronButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextPatronButton.Click
Dim msgstring As String = "Clear all totals?"
Dim whichbutton As DialogResult
MessageBox.Show(msgstring, "Next Patron", MessageBoxButtons.YesNo)

If whichbutton = DialogResult.Yes Then
MakeoverAmountTextBox1.Clear()
HairStylingAmountTextBox.Clear()
ManicureCostTextBox.Clear()
PermanentMakeupCostTextBox.Clear()
SubtotalTextBox2.Clear()
DiscountRateTextBox1.Clear()
With TotalTextBox
.Clear()
.Focus()
End With
End If
End Sub

Private Sub SummaryButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SummaryButton.Click

Dim msgstring As String = "Total Value for Services Rendered: " & TotalDecimal.ToString("C") & ControlChars.NewLine

MessageBox.Show(msgstring, "Summary")


End Sub
End Class

Viewing all articles
Browse latest Browse all 27027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>