Any Microsoft VB Guru's out there?

For any off topic posts. Please keep it mostly clean and we'll all get along.

Post Reply
Rich tideswell
Broke 1000
Broke 1000
Posts:1134
Joined:Wed Oct 18, 2006 11:18 pm
Location:MOTOR CITY
Contact:
Any Microsoft VB Guru's out there?

Post by Rich tideswell » Wed Dec 15, 2010 10:20 pm

I need help with my final exam, here's what I have

Code: Select all

Public Class Rental
    Private MovieTitleString As String
    Private VHSBoolean, DVDBoolean As Boolean
    Private PriceDecimal, TotalDecimal As Decimal
    Const VHS_CHARGE_Decimal As Decimal = 1.8D
    Const DVD_CHARGE_Decimal As Decimal = 2.5D
    Private Shared SalesTotalDecimal As Decimal
    Private Shared SalesCountInteger As Integer

    Public Sub New(ByVal MovieTitleIncoming As String, ByVal PriceIncoming As Decimal, ByVal DVDIncoming As Boolean, ByVal VHSIncoming As Boolean, ByVal TotalIncoming As Decimal)

        'Assign the properties in the constructor
        MovieTitle = MovieTitleIncoming
        Price = PriceIncoming
        DVD = DVDIncoming
        VHS = VHSIncoming
        Total = TotalIncoming

    End Sub

    Shared ReadOnly Property SalesTotal() As Decimal
        Get
            Return SalesTotalDecimal
        End Get
    End Property

    Shared ReadOnly Property SalesCount() As Integer
        Get
            Return SalesCountInteger
        End Get
    End Property

    Property MovieTitle() As String
        Get
            Return MovieTitleString
        End Get
        Set(ByVal value As String)
            MovieTitleString = value
        End Set
    End Property

    Property Price() As Decimal
        Get
            Return PriceDecimal
        End Get
        Set(ByVal value As Decimal)
            If value >= 0 Then
                PriceDecimal = value
            End If
        End Set
    End Property

    Property Total() As Decimal
        Get
            Return TotalDecimal
        End Get
        Set(ByVal value As Decimal)
            If value >= 0 Then
                TotalDecimal = value
            End If
        End Set
    End Property

    WriteOnly Property VHS() As Boolean
        Set(ByVal Value As Boolean)
            VHSBoolean = Value
        End Set
    End Property

    WriteOnly Property DVD() As Boolean
        Set(ByVal Value As Boolean)
            DVDBoolean = Value
        End Set
    End Property

    Protected Overridable Sub CalculateAmountDue()
        'Return the amount due

        'Test the option buttons for charges
        If VHSBoolean Then
            PriceDecimal += VHS_CHARGE_Decimal
        ElseIf DVDBoolean Then
            PriceDecimal += DVD_CHARGE_Decimal
        End If

        'Calculate the subtotal 
        Total = PriceDecimal
    End Sub
End Class

Public Class VideoBonanzaForm
    Private TheRental As Rental()
    
    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        AboutForm.Show()
    End Sub

    Private Sub CompleteSaleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompleteSaleToolStripMenuItem.Click
        SummaryForm.Show()

    End Sub

    Private Sub CalculateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateToolStripMenuItem.Click
        'calcuclate the total amuont due
        Try
            If MemberCheckBox.Checked Then
                'Istantiate the StudentBookSale object dn set the properties
                TheRental = New Rental(MovieTitleTextBox.Text, Decimal.Parse(DVDRadioButton), Decimal.Parse(VHSRadioButton), Decimal.Parse(ItemAmountTextBox.Text))
                'calculate and format the result
                TotalAmountDueTextBox.Text = Rental.Total.ToString("C")
            Else
                TheRental = New Rental(MovieTitleTextBox.Text, Decimal.Parse(DVDRadioButton), Decimal.Parse(VHSRadioButton), Decimal.Parse(ItemAmountTextBox.Text))
            End If
        Catch
            MessageBox.Show("Enter numeric data.", "Video Bonanza", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
    End Sub
End Class

Public Class Member
    Inherits Rental

    Private Shared DiscountTotalDecimal As Decimal
    Const Discount_Rate_Decimal As Decimal = 0.15D
    Private TheMemberSale As Member

    Sub New(ByVal TitleIncoming As String, ByVal VHSIncoming As Boolean, ByVal DVDIncoming As Boolean, ByVal PriceIncoming As Decimal, ByVal TotalIncoming As Decimal)
        'call the base class constructor

        MyBase.New(TitleIncoming, VHSIncoming, DVDIncoming, PriceIncoming, TotalIncoming)
    End Sub

    Shared ReadOnly Property DiscountTotal() As Decimal
        Get
            Return DiscountTotalDecimal
        End Get
    End Property

    Protected Overrides Sub CalculateAmountDue()
        ' calculate the the discount, extended price and add to the total
        Dim DiscountDecimal As Decimal

        DiscountDecimal = Price * Discount_Rate_Decimal
        Total = Price - DiscountDecimal
        DiscountTotalDecimal += DiscountDecimal
    End Sub

End Class
And 5 errors

Code: Select all

Error	1	Value of type 'System.Windows.Forms.RadioButton' cannot be converted to 'String'.	VideoForm.vb	22	78	

Error	2	Value of type 'System.Windows.Forms.RadioButton' cannot be converted to 'String'.	VideoForm.vb	22	109	

Error	3	'Total' is not a member of 'System.Array'.	VideoForm.vb	24	46	

Error	4	Value of type 'System.Windows.Forms.RadioButton' cannot be converted to 'String'.	VideoForm.vb	26	78	

Error	5	Value of type 'System.Windows.Forms.RadioButton' cannot be converted to 'String'.	VideoForm.vb	26	109
Thought for the day: Ever notice that the battery size in women's vibrators corresponds to bra sizes???? (AA's, C's, D's..etc...)

2005 Dodge Neon SRT-4 ACR; PX8 black, vipers w/ pass through harness slots in seats, sunroof, and kicker sound.

2005 Dodge Neon SRT-4 Commemorative Edition #142; Vipers, Sunroof, Kicker sound

sllywhtboy
Former Admin
Former Admin
Posts:1178
Joined:Sat Feb 21, 2004 5:53 pm
Location:48071
Contact:

Re: Any Microsoft VB Guru's out there?

Post by sllywhtboy » Wed Dec 15, 2010 11:09 pm

maybe you shouldn't pull radiobutton and convert it to a string? is there a radiobutton.text or radiobutton.value function?

i really haven't worked with vb. it's nice to see that you declare up front how parameters are passed (by value, reference, etc).

error 3: i see total being declared as a float. i would see if any variable you're using with 'total' is maybe an array.
[quote="Greg"]Heh. Good riddence.[/quote]
another non-dnowner

Rich tideswell
Broke 1000
Broke 1000
Posts:1134
Joined:Wed Oct 18, 2006 11:18 pm
Location:MOTOR CITY
Contact:

Re: Any Microsoft VB Guru's out there?

Post by Rich tideswell » Fri Dec 17, 2010 8:10 am

big thanks to all the help and suggestions, but i had to turn it in before midnight last night, so it is what it is now.
Thought for the day: Ever notice that the battery size in women's vibrators corresponds to bra sizes???? (AA's, C's, D's..etc...)

2005 Dodge Neon SRT-4 ACR; PX8 black, vipers w/ pass through harness slots in seats, sunroof, and kicker sound.

2005 Dodge Neon SRT-4 Commemorative Edition #142; Vipers, Sunroof, Kicker sound

Rich tideswell
Broke 1000
Broke 1000
Posts:1134
Joined:Wed Oct 18, 2006 11:18 pm
Location:MOTOR CITY
Contact:

Re: Any Microsoft VB Guru's out there?

Post by Rich tideswell » Sat Dec 18, 2010 9:26 pm

passed the class with a b+ overall, got a b- on the final
Thought for the day: Ever notice that the battery size in women's vibrators corresponds to bra sizes???? (AA's, C's, D's..etc...)

2005 Dodge Neon SRT-4 ACR; PX8 black, vipers w/ pass through harness slots in seats, sunroof, and kicker sound.

2005 Dodge Neon SRT-4 Commemorative Edition #142; Vipers, Sunroof, Kicker sound

Post Reply