Hi All.. Looking for the 'proper' way to use the msgboxresult.YES/NO here in my case. I am either using openfiledialog to browse or I am loading the most recent file. After that, I am loading a bunch of textboxes from a file. I just can't determine how this needs to be so that I am not duplicating all of my textbox entries based on the YES or NO. Not sure if I am even writing it correctly. Having a serious brain-block here. I hope I am making sense... Thanks for any help.


Code:
Sub SelectFile()

       Dim ans As Integer
        ans = MsgBox("YES: Load Recent File.  NO: Browse for File.", MsgBoxStyle.YesNo, "Load File?")

        If ans = MsgBoxResult.Yes Then
            Dim newestfile As String = Directory.GetFiles(fpath, "*.txt") _
            .Select(Function(x) New FileInfo(x)) _
            .OrderByDescending(Function(x) x.LastWriteTime) _
            .Select(Function(x) x.FullName) _
            .First()


''' somewhere if ans = no then openfiledialog?

            Using dialog As New OpenFileDialog

                dialog.Title = "Select Text File"
                dialog.InitialDirectory = fpath
                dialog.Filter = "Text Files|*.txt"

                If dialog.ShowDialog() = DialogResult.OK Then

                    Dim sr As IO.StreamReader = IO.File.OpenText(dialog.FileName)
                    Dim line As Object
                    Dim data() As Object

                    Do Until sr.EndOfStream
                        line = sr.ReadToEnd
                        data = line.Split(",")

                    ' Load All TextBoxes Here...

                   Loop

                  sr.Close()

               End If
           End Using
       End If

 End Sub