title: VB : How to start my program and read a file by click the file in 'File Explorer'?
body: <p>I know how to write and read file. I put some code to open my own file. If I want to open file, I can click "File > Open" in my program. It had not problem about it.</p>
  
  <p>However I want to develop my program to be better that. In general program, when click file in File Explorer, the program will start and read the file. Example I click ".avi" video file and my default program will start and play video.</p>
  
  <p>I try that in my program. The save file for my program is ".mmr" binary file. I don't have problem to save it and I can open it correctly by click "File > Open" in my program. I set my program at default to open ".mmr" in File Explorer. When I double click ".mmr" file in File Explorer, my program starts, but nothing happens after that. I know I didn't put code to read file when my program starts.</p>
  
  <p>This is my source code.</p>
  
  <pre><code>Public strFileLocation As String 'File location
  
  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
  End Sub
  
  Private Sub subOpen()
  
  'There are code to read my '.mmr' file.
  
  'I didn't use parameter. I use variable for file location because my program is too complex to use parameter for it.
  'strFileLocation should be the open file location.
  
  End Sub
  </code></pre>
  
  <p>How to make program knows it starts with open file (read file after program starts) or without open file (nothing to do)?</p>
  
  <p>How to strFileLocation gets the open file location (the file that I click in File Explorer)?</p>