結果が異なるネストされたelse if文を処理する優れた方法はありますか?ここで異なる結果を持つ入れ子のElse If文に代わるものはありますか?
を説明するために私のネストされたステートメントの1の例である:
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
私は文のこれらのタイプの多くの要求を持っている、いくつかのいくつかは、多くの大きい、小さいです。
注プログラムでのメッセージは、あなたが接続を失った時のアクションに対応していないこと。それはあなたが見せたいものに続く行動を示しています。以下の答えは正しい結果をもたらします。なぜなら、あなたが例外をスローした場合、あなたはそれをAFTERWARDS – Martin