0
我在這段代碼中遇到問題,因爲我沒有返回任何東西!在VB.net中返回函數
它的工作正如我想它沒有返回,但當我返回它崩潰。
你能幫忙嗎?
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
此代碼也是同樣的問題!
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
我在網上查了一下,但我不明白他們使用的方法,這就是爲什麼它更好地問一個直接的問題,謝謝。
將它指定爲布爾值是什麼意思? –
你走了,回答改善了。 – Jordumus
我無法投票我需要15代表抱歉 –