Dim path As String = Application.StartupPath
Dim found As Boolean = False
Do
found = File.Exists(System.IO.Path.Combine(path, "sample.xml"))
If Not found And path.Length > 3 Then
path = System.IO.Path.GetDirectory(path)
End If
Loop While Not found OrElse String.IsNullOrEmpty(path)
If found Then
path = System.IO.Path.Combine(path, "sample.xml")
' do something with the path
End If