程序是否成功结束时在文本框中显示消息
Show Message in text box when program ends successfuly or not
我有以下代码,当它运行时更新 14 个表,想知道如何使用下面模板中的文本框显示消息,显示订阅是否成功结束。
[Private Sub Command0_Click()
'Sub 1
A_Forecast
'Text box showing the msg OK or failed
A_ForecastTxt "OK" or "Not"
'Sub 2
B_Forecast
'Text box showing the msg OK or failed
B_ForecastTxt "OK" or "Not"
End Sub][1]
将潜艇变成函数,因为它们可以return一个值:
Private Sub Command0_Click()
Dim Success As Boolean
' Function 1
Success = A_Forecast
' Text box showing the msg OK or failed
MsgBox IIf(Success, "OK", "Failed")
' Function 2
Success = B_Forecast
' Text box showing the msg OK or failed
MsgBox IIf(Success, "OK", "Failed")
End Sub
示例:
Public Function A_Forecast() As Currency
Dim Result As Currency
Dim Something As Boolean
' Your code:
Something = True ' or False
If Something = True Then
Result = 100
Else
Result = 200
End If
A_Forecast = Result
End Function
我有以下代码,当它运行时更新 14 个表,想知道如何使用下面模板中的文本框显示消息,显示订阅是否成功结束。
[Private Sub Command0_Click()
'Sub 1
A_Forecast
'Text box showing the msg OK or failed
A_ForecastTxt "OK" or "Not"
'Sub 2
B_Forecast
'Text box showing the msg OK or failed
B_ForecastTxt "OK" or "Not"
End Sub][1]
将潜艇变成函数,因为它们可以return一个值:
Private Sub Command0_Click()
Dim Success As Boolean
' Function 1
Success = A_Forecast
' Text box showing the msg OK or failed
MsgBox IIf(Success, "OK", "Failed")
' Function 2
Success = B_Forecast
' Text box showing the msg OK or failed
MsgBox IIf(Success, "OK", "Failed")
End Sub
示例:
Public Function A_Forecast() As Currency
Dim Result As Currency
Dim Something As Boolean
' Your code:
Something = True ' or False
If Something = True Then
Result = 100
Else
Result = 200
End If
A_Forecast = Result
End Function