Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
RichTextBox1.ZoomFactor = "1"
RichTextBox1.AllowDrop = True
'This registery code doesn't work
'This app does not have permissions to write to that part of the registery
'This registery change should be done by the installer, not this application
'My.Computer.Registry.SetValue("HKEY_CLASSES_ROOT\PAWN.Script\shell\Check with BracketFinder\command", "", "C:\Documents and Settings\Anis\My Documents\Visual Studio 2010\Projects\BracketFinder\BracketFinder\bin\Release\BracketFinder.exe")
If Environment.GetCommandLineArgs.Count > 1 Then
Dim Arg1 As String = Environment.GetCommandLineArgs(1)
If System.IO.File.Exists(Arg1) Then Call OpenFile(Arg1)
End If
End Sub
Private Sub OpenFile(ByVal Path As String)
Dim sr As System.IO.StreamReader = Nothing
Try
sr = New System.IO.StreamReader(Path)
RichTextBox1.Text = sr.ReadToEnd()
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error reading file")
Finally
If sr IsNot Nothing Then
sr.Close()
sr.Dispose()
End If
End Try
End Sub