Code: |
Shell "notepad.exe yourdoc.txt", vbNormalFocus |
Code: |
Private Function GetFromFile() As Boolean
Try List1.Items.Clear() 'Clear the list before we can load from the text file Dim sr As StreamReader sr = File.OpenText(Application.StartupPath & "\Test.txt") Dim strItems As String 'loop through the text file While sr.Peek <> -1 strItems = sr.ReadLine() List1.Items.Add(strItems) 'add the contents to the list box End While sr.Close() 'close the file Return True 'file was there...with no errors Catch 'ignore errors Return False 'most likely we don't have file permission (to delete) End Try End Function |
Code: |
Private Function GetFromFile() As Boolean Try List1.Items.Clear() 'Clear the list before we can load from the text file Dim sr As StreamReader sr = File.OpenText(Application.StartupPath & "\Test.txt") Dim strItems As String 'loop through the text file While sr.Peek <> -1 strItems = sr.ReadLine() List1.Items.Add(strItems) 'add the contents to the list box End While sr.Close() 'close the file Return True 'file was there...with no errors Catch 'ignore errors Return False 'most likely we don't have file permission (to delete) End Try End Function |
Code: |
Private Sub Command1_Click() End Sub |
Code: |
Private Sub Command1_Click() Dim sr As StreamReader sr = File.OpenText(Application.StartupPath & "C:\Windows\Desktop\Test.txt") End Sub |
loopers wrote: | ||
So now, I will try to implement the code that you have given me. Here is what I did ...
But I still can't open a text file called Test.txt |
output generated using printer-friendly topic mod, All times are GMT + 2 Hours