I have a problem in this code because I am not returning any thing!
It works Just as I want it without returning but when I return it crashes.
Can you please help?
Public Function Clear() As Boolean
'resetting the variuabels to be ready for next Order
ZYZZ = "0"
VAT = "0"
MAX = "0"
'this code is 3 peices
'This is sitting ctrl as a new control
Dim ctrl As Control = Me.GetNextControl(Me, True)
'1- is to look for text box and change them to 0 after the button is pressed
Do
If TypeOf ctrl Is TextBox Then
ctrl.Text = "0"
End If
ctrl = Me.GetNextControl(ctrl, True)
Loop Until ctrl Is Nothing
'2- it clears the list box
OrderListBox.Items.Clear()
'And uncheck the check boxes
LoyalCheckBox.Checked = False
TakeAwayCheckBox.Checked = False
'Finally it resets the Price, VAT, Total in the UI
Label6.Text = "£" & " " & "0"
Label7.Text = "£" & " " & "0"
Label8.Text = "£" & " " & "0"
'Clearing the array to prepare for next order
arr.Clear()
End Function
Also same problem in this code!
Private Function calculate() As Boolean
'=================================='
ZYZZ = 0
For i As Integer = 0 To arr.Count - 1
ZYZZ = ZYZZ + arr(i)
Next i
'=================================='
'=================================='
If LoyalCheckBox.Checked = True Then
CardT = ZYZZ * card
Else
CardT = "0"
End If
If TakeAwayCheckBox.Checked = True Then
TAF = ZYZZ * TA
Else
TAF = "0"
End If
'=================================='
VAT = ZYZZ * cVAT
MAX = ZYZZ - (CardT + TAF) + VAT
Label6.Text = "£" & " " & ZYZZ
Label7.Text = "£" & " " & VAT
Label8.Text = "£" & " " & MAX
End Function
I have looked up online but I did not understand the methods they are using that's why its better to ask a direct question, thank you.
Aucun commentaire:
Enregistrer un commentaire