Mousa Alfhaily
Mousa Alfhaily

Reputation: 1290

"System.IO.StreamWriter" or "System.IO.StreamReader" code in VB.Net - How to find correct file paths?

I have a big problem, and that is my problem in all my applications.

My problem is:

In any of my applications, i got used the "System.IO.StreamWriter" or "System.IO.StreamRead" code, for example:

Dim WriterDay6 As New System.IO.StreamWriter("C:\Users\IOSEagle\Desktop\My Projects\Microsoft Visual Basic 2010\Form\Programs\MyAlarm\MyAlarm\RepeatDays\Saturday.txt")

But this path does not exist in another computers.

So, any one help me please?

Upvotes: 0

Views: 574

Answers (1)

Joel Coehoorn
Joel Coehoorn

Reputation: 415880

Take a look at the Environment.SpecialFolder enumeration. This lists out various folders you can use, like the Desktop, Application Data, and My Documents folders.

In VB.Net, you can also look at My.Computer.FileSystem.SpecialDirectories.

Upvotes: 2

Related Questions