title: How to create and open a file document
body: <p>I have the following method/procedure </p>
  
  <pre><code>Private Sub CreateFile(ByVal filename As String, ByVal directory As String, ByVal extension As String)
  
      Dim file2create = directory &amp; filename &amp; extension
      Console.WriteLine(file2create)
      If (Not File.Exists(file2create)) Then
          File.Create(file2create)
      Else
          File.Open(file2create, FileMode.Open)
      End If
      console.ReadLine()
  End Sub
  </code></pre>
  
  <p>This code successfully creates a file but fails to open it, and just to say, I've checked other answers with similar questions but said answers haven't solved my problem, what I'm I doing wrong here. Thanks</p>
  
  <p>================================UPDATE====================================</p>
  
  <p>Thanks for the answers guys, but the file isn't opening. Just to clarify, when I say open, I mean thesame act as physically going to the file and clicking it.</p>
  
  <p>If i were to use this code from this <a href="https://stackoverflow.com/questions/12778249/how-to-open-selected-files-through-the-default-application-of-the-file-in-vb-201">question</a> </p>
  
  <pre><code>   Private Function ShellExecute(ByVal File As String) As Boolean
  
        Dim myProcess As New Process
        myProcess.StartInfo.FileName = File
        myProcess.StartInfo.UseShellExecute = True
        myProcess.StartInfo.RedirectStandardOutput = False
        myProcess.Start()
        myProcess.Dispose()
  
      End Function
  </code></pre>
  
  <p>the file would successfully open, but if I were to use file.open() the file would not open, so in essence, I'm looking to create and then open a file in the same manner the above code does</p>