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

• 0

Calculation Problem

Question

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

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.Text

Edited by Kaylee lee

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 on other sites
• 0
OliverRobinson    0

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