わかりました。次のコードは、テキストファイルを読み取って、行内の特定の文字列を検索しています。文字列が見つかった場合は何もしたくないし、見つからなかった場合は別のことをしたい。現在、条件ごとにmsgboxがあります。
私が抱えている問題は、文字列が見つからない場合、msgboxをトリガーしないことです。ただし、他のmsgboxは、文字列が見つかったときにトリガーされます。
何か案は?
Dim logfile() As String = System.IO.File.ReadAllLines("C:\Temp\Transfer_Log.txt")
Dim searchstring As String = "Test_" + DateTimePicker2.Value.ToString("yyyyMMdd") + ".csv"
For Each line As String In Filter(logfile, searchstring)
If line.Contains("Test_" + DateTimePicker2.Value.ToString("yyyyMMdd") + ".csv") Then
MsgBox("Do Nothing") 'THIS WORKS
Else
MsgBox("Append") 'THIS DOES NOT WORK
End If
Next