1
我不知道要搜索什麼關鍵字。從Public Sub獲取DialogResult(模塊)
這是在我的應用程序模塊。
Public Sub msgYNC(ByVal result As DialogResult)
result = MessageBox.Show("Are you sure you want to save and continue?", "RM Farms Confirmation", _
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
End Sub
現在我想在窗體上使用它。所以,當我點擊確認:
Dim result As DialogResult
msgYNC(result)
If result = Windows.Forms.DialogResult.Yes Then
'yes
ElseIf result = Windows.Forms.DialogResult.No Then
'n
ElseIf result = Windows.Forms.DialogResult.Cancel Then
'ca
End If
但它不會返回我什麼。我沒有得到迴應。我不確定如何編碼,你能指出什麼是錯的?
感謝,合作。等待5分鐘以接受答案。現在我想我知道爲什麼,是不是因爲'result'的值在子? – AdorableVB
這是正確的,要記住的關鍵句子是:'byval'沿着值傳遞(不參考對象),'byref'沿着對象及其值的引用傳遞。 – User999999