> Visual Basic help!!!?

Visual Basic help!!!?

Posted at: 2014-12-18 
'get the folder used for application data....

Dim fPath As String = Environment.GetFolderPath _

(Environment.SpecialFolder.ApplicationDa...

'add the file name to it

fPath = IO.Path.Combine(fPath, "words.txt")

'write some text to it

System.IO.File.AppendAllText(fPath, "This is new text to be added.")

You could use something like

%HOMEPATH%\Documents

The %homepath% variable points to the current users home directory on a Windows system, so you do not have to know user names or exact paths.

The user always has a 'Documents' directory & it's where text files etc. would normally be located.

See below for more info:

Also apparently in VB you can retrieve the whole path to the users my documents directory with

System.Environment.GetFolderPath(System...

http://libertyboy.free.fr/computing/refe...

http://stackoverflow.com/questions/11437...

You can make installer, then your text file and app will be in the same folder, installer would create desktop shortcut for example. If you would like to create installer in visual basic, and you don't know how, please add me on facebook, my name is Vprogrammer Programmer. I hope this helps...

I am trying to make a program where it writes to a text document

I am using this code

System.IO.File.AppendAllText("C:\Users\Youss_001\Documents\Visual Studio 2008\Projects\WindowsApplication1\WindowsApplication1\words.txt", "This is new text to be added.")

The problem is that if I move around the file of the program then the text document would be somewhere else and then my program won't know where the text document would be, so is it possible to write the directory of the text document in a way so that the program just looks for the text document in the folder of the program directory.