[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

browsing to folder to select a file/folder and concatenating the string for a specified path in VB.NET

I am building an application in VB.NET which gives the user to select the path of the file/folder by browing through the drives.Currently, I am able to browse to the selected folder.After selecting the folder, this is being stored in a string and stored in a database table under PROJECT_DIRECTORY record.Below is the example..

database table

PROJECT_DIRECTORY

\projects\internet
\projects\intranet
\projects\devonline
\projects\testonline

When the user tried to browse to the desired location, it can be any drive (C : , D : , Z : ) and it can also start from the actual location ( for example internet ,intranet ) depending upon the way the use sets up his driver.

No matter how the user selects his location, I need to get the string starting from \projects and store that in the database.

Please let me know if you have any questions.Thanks for your help.

0
g46905
Asked:
g46905
  • 4
  • 4
1 Solution
 
Fernando SotoCommented:
Hi g46905;

You can accomplish what you want with the following:

    Dim str As String

    ' If str holds the directory path then
    index = str.LastIndexOf("projects")
    str = str.Remove(0, index - 1)
0
 
g46905Author Commented:
The above mentioned code is very helpful.However, If the user network connection is already having thier default pat

For example :

Actual path of a particular folder is

\projects\internet\web\resource\Project name

and the user setup his default path to be starting from "\resource"

I am unable to get the entire path ie "\projects\internet\web\resource\Project name".

It is taking it as "\resource\Project name" and this is not what I wanted.Could you help me how to get the actual path even if the user has his default path?

Please suggest
0
 
Fernando SotoCommented:
When the user sets up there default path starting with "\resource" as given in your example above. There is no way to determine at a later date minutes, hours, days later what the whole path is unless you save it some where. Two places come to mind, 1 The Registry 2 Isolated Storage.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
g46905Author Commented:
Is there a way to find the path of the network drive ( this can be address of the website, ftp connection or network location that this shortcut location will open)

The user has a network place ( this can be address of the website, ftp connection or network location that this shortcut location will open) and i want to check if the path contains "/projects" .Could you please tell me how I can acheive this?

Thanks,

0
 
Fernando SotoCommented:
Not that I know of, sorry.
0
 
g46905Author Commented:
I have come across "Server.MapPath" but I am not sure if this reallt helps me.Do you knoe the purpose of this?

Thanks
0
 
g46905Author Commented:
As I mentioned, I am developing my application using VB.NET and want ot know if there is any similar fuctionality to Server.MapPath which is in ASP.NET

Please suggest
0
 
Fernando SotoCommented:
I do not program in ASP.Net and would not know of any functionality that would provide what you are looking for, sorry.

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now