• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0

Calculation Problem


Kaylee lee    0
Posted (edited)

I try to play 

to select different checbox n then press the textbox quantity - for example i try to type 15 in the textbox quality but then the stock and total textbox turn zero. 

Plus I'm beginner, I want to know what's wrong or something missing in this coding n let me know, i want to finish my homework as soon as possible before sunday.

how to select combobox delivery to add in total label?

        'step 1 : variable Declaration

        Dim Quantity As Single
        Dim Stock As Single
        Dim Qty2 As Single
        Dim Stock2 As Single
        Dim qty3 As Single
        Dim Stock3 As Single
        Dim Qty4 As Single
        Dim stock4 As Single
        'Dim Total As single

        'Step 2 : Variable Expression


            Quantity = txtQty_Rose.Text
            Stock = lblStock_Rose.Text
            Qty2 = CType(txtQty_Lily.Text, Integer)
            Stock2 = lblStock_Lily.Text
            qty3 = CType(txtQty_Sunflower.Text, Integer)
            Stock3 = lblStock_Sunflower.Text
            Qty4 = CType(txtQty_Morning_Glory.Text, Integer)
            stock4 = lblStock_Key.Text
            'Total = lblTotal.Text

        Catch ex As Exception

            'step 3: output
            If chkRose.Checked = True Then
                lblStock_Rose.Text = Stock - Quantity
                txtTotal_Rose.Text = Quantity * 10
            End If
            If chkLily.Checked = True Then
                lblStock_Lily.Text = Stock2 - Qty2
                txtTotal_Lily.Text = Qty2 * 20
            End If
            If chkSunflower.Checked = True Then
                lblStock_Sunflower.Text = Stock3 - qty3
                txtTotal_Sunflower.Text = qty3 * 12
            End If
            If chkMorning_Glory.Checked = True Then
                lblStock_Key.Text = stock4 - Qty4
                txtTotal_Glory.Text = Qty4 * 20
            End If

        End Try

        lblTotal.Text = "Total :" & ("£") & txtTotal_Rose.Text + txtTotal_Lily.Text + txtTotal_Sunflower.Text + txtTotal_Glory.Textimage.thumb.png.af32d8fbdfe53b1ccdea79e6697234b3.png


Edited by Kaylee lee

Share this post

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Kaylee lee    0

I know the problem already except the lblTotal.Text = I try to sum some textbox plus add comboboxdelivery

Share this post

Link to post
Share on other sites
  • 0
OliverRobinson    0

Hey can't understand your problem but I am trying.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.