# Thread: Distrition of a vb 2019 applicazione

1. ## Distrition of a vb 2019 applicazione

In VB 2019 i created a little application using Add Windows Form. To read an external text file I had to say the path where it was, for example "c:\users\myname\desktop\text.txt". So far no problem. It works and read my file assigning it to a RichTextBox.
The question is: if i distribute the app to work on other computer it will always point to the address I wrote in the code but on the other computer it may not be that path.
How to solve? Have I to tell whoever receives the application to create a directory with the same name and insert there the file? Or it is possible to do otherwise.

2. ## Re: Distrition of a vb 2019 applicazione

You need to use an openfiledialog object, so you can go to look for your file where you want : https://docs.microsoft.com/en-us/dot...g?view=net-5.0

3. ## Re: Distrition of a vb 2019 applicazione

Take a look at the Application Class documentation which will provide paths specific to the application and user folder e.g.if you place the text file in the same folder as the executable you can use Application.StartupPath property, to get the folder name which you use when opening the file. https://docs.microsoft.com/en-us/dot...h?view=net-5.0

4. ## Re: Distrition of a vb 2019 applicazione

If you specifically want to read the file from the desktop then you can use code that will resolve the desktop folder every time:
vb.net Code:
Dim filePath = Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "text.txt")
Now you can just tell all users to put a file with that name on their desktop. If you want to be able to read the file from anywhere, do as suggested by Delaney above.

5. ## Re: Distrition of a vb 2019 applicazione

thank you very much

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•