I have an app made with vb2010. When I double click the text file I want to open the text file in an application created with vb2010.
I use the following code, but when I try to open the text file with my application, it closes as fast as it opens.
Also the listbox should be enabled when the item count is greater then zero and the filename of the text file should be in the statusbar label.
On form_load
Thanks
I use the following code, but when I try to open the text file with my application, it closes as fast as it opens.
Also the listbox should be enabled when the item count is greater then zero and the filename of the text file should be in the statusbar label.
On form_load
VB.NET:
Dim cla As String() = Environment.GetCommandLineArgs()
Dim file_line As String
If cla.Length > 1 Then
myStreamReader = System.IO.File.OpenText(cla(1))
While myStreamReader.Peek >= 0
file_line = myStreamReader.ReadLine
ListBoxControl1.Items.Add(file_line)
End While
myStreamReader.Dispose()
If ListBoxControl1.Items.Count > 0 Then
ListBoxControl1.Enabled = True
End If
End If
Thanks