Code:
Private Sub ManipulateFile()
'First File Path
'Dim filepath As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\Hello.txt"
'Second File Path
Dim filepath As String = Application.StartupPath & "\Hello.txt"
Dim fs As FileStream = Nothing
Try
fs = New FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.None)
fs.Close()
Catch ex As Exception
End Try
Try
Dim sw As StreamWriter = Nothing
sw = New StreamWriter(filepath)
sw.WriteLine("Hello World")
sw.Flush()
sw.Close()
Catch ex As Exception
End Try
End Sub
show the file in debug folder or release folder when I run from inside visual studio ide but if I create a setup and run the exe, the file is not found
inside the application folder. But if I use the second file path everything is OK, the file can be found in the desktop.
Please help me understand this issue.