有没有更好的方法来处理嵌套的else if语句有不同的结果?替代嵌套Else如果语句的结果不同?
这里是我的嵌套语句的一个解释的例子:
If My.Computer.Network.Ping(computerName) = True Then
Call InstallVS(computerName)
If My.Computer.Network.Ping(computerName) = True Then
Call PEC(computerName)
If My.Computer.Network.Ping(computerName) = True Then
Call RemoveSoftware(computerName)
Else
Call WriteLog(computerName & " lost connectivity while attemping to remove the temp software")
End If
Else
Call WriteLog(computerName & " lost connectivity while Forcing Communication")
End If
Else
Call WriteLog(computerName & " lost connectivity while attemping to Install")
End If
我有很多这些类型的报表的要求,一些比较小的,有些是很多大。
注意,在你的程序中的消息不与在此期间,你失去了连接的动作相对应。它显示了您想要显示的动作之后的动作。下面的答案给出了正确的结果,因为在执行操作之前建立了消息文本,而您的操作在执行后会在 – Martin 2012-02-21 13:58:58