• 0

Calculation Problem


Question

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

        Try

            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
Link to comment
https://www.neowin.net/forum/topic/1371100-calculation-problem/
Share on other sites

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Posts

    • The Nokia Lumias? Or the third-party HTC One8's? I had HTC's hardware cuz it was slick and reliable... but, yeah, the software left me wanting more and I just couldn't allocate personal time to develop all of the software I would have wanted to see (overworked in other capacities @ MSFT at the time, heh).
    • Microsoft's mobile strategy had great future vision and UX research, but mediocre engineering and inadequate support (third-party and internal business alike). The death knell for WinMo was Google's (mostly YouTube's) incessant API blocking and purposeful release of buggy WinMo builds to force consumers to stay away -- and this was conducted via sabotage of whatever partnerships they were supposed to play nice in. I still yearn for that UI on a modern smartphone...
    • Linux has always been an option but never adopted by the masses despite being free. The reasons are limited usability and features. Despite everything we all complaint about with MS , the overall experience for the general public is much better than what Linux can deliver.
    • If nothing works automatically for you, I'd say pick a better/different distro. Granted, it's trickier with laptops because they use all kinds of weird hardware, but still. I actually just did a fresh Arch Linux install on my netbook, and given that Arch is certainly not an "automagical" distro, I had to do very little manual tweaking, everything but the audio worked out of the box (including plasma and Wayland) and the audio was simply an issue of installing an additional firmware package that wasn't included in the default selection. Which is equivalent of installing additional drivers in Windows. Surely a more user-oriented distro would be even less troublesome (but granted, I haven't used/tested anything outside of Arch for quite some time). And let's not forget that a fair bit of issues that get blamed on Linux (though it also applies to Windows issues) are actually caused by hardware vendors not giving a damn.
    • The reason Linux will never succeed for consumers is simple. There are 800 distro’s and 400 active versions. As a consumer, “I want Linux” - great, which one? No single App Store, and websites will say “use this app, oh, sorry, doesn’t work on yours”. No single place for support, community help is reduced, so many apps don’t work or have compatibility problems. Drivers from manufacturers have issues. The gaming industry isn’t behind it. if you have an old pc, then sure, try Linux, you might love it. But the arguments above don’t stack up.
  • Recent Achievements

    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
    • One Year In
      Orpheus13 earned a badge
      One Year In
    • One Month Later
      Orpheus13 earned a badge
      One Month Later
    • Week One Done
      Orpheus13 earned a badge
      Week One Done
    • Week One Done
      serfegyed earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      563
    2. 2
      ATLien_0
      256
    3. 3
      +Edouard
      163
    4. 4
      +FloatingFatMan
      157
    5. 5
      Michael Scrip
      109
  • Tell a friend

    Love Neowin? Tell a friend!