Results 1 to 2 of 2

Thread: Question about Classes

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    10

    Question about Classes

    I am making a program for my CIS class. She gave us an example and I am trying to create it on my own. In VB.net, she has it seperated into like three different forms if you view it in the code window. There is the main form (Form1.vb) then two other forms she made called petstore.vb and petstorediscounted.vb


    How do i make it so it creates two seperate forms in addition to the main one? Thanks in advance. This is what I have in my main form so far.....

    Dim mypetstore As mainpetstore
    Dim mypetstorediscount As mainpetscorediscount

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

    mypetstore = New mainpetstore
    mypetstorediscounted = New mainpetstorediscounted

    mypetstore.Cat = radCat.Checked
    mypetstore.Dog = radDog.Checked
    mypetstore.Quantity = CDbl(txtQuantity.Text)

    mypetstorediscount = radCat.Checked
    mypetstorediscount = radDog.Checked
    mypetstorediscount = CDbl(txtQuantity.Text)

    If chkMember.Checked Then
    txtResults.Text = FormatCurrency(mypetstorediscount.ExtendedPrice)
    Else
    txtResults.Text = FormatCurrency(mypetstore.ExtendedPrice)
    End If
    End Sub
    End Class

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Question about Classes

    You need to decide if you're going to use mypetstorediscount or mypetstorediscounted in your code.

    Why are you doing this:

    Code:
     mypetstorediscount = radCat.Checked
            mypetstorediscount = radDog.Checked
            mypetstorediscount = CDbl(txtQuantity.Text)
    ?

    To show the forms, use the .Show() method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width