Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Browse for a file on a network

Posted on 2003-11-21
5
Medium Priority
?
317 Views
Last Modified: 2010-05-01
I have created a program that relies on the utilisation of another file. I have currently got a form that allows you so select the drive, directory and then file, using the respective VB controls and synchronisation between them. This works well, however I would like to be able to browse through the entire network stucture to select the file. Any ideas on how to do this. Im sure it's trivial, I just dont know how!
0
Comment
Question by:Ice123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 9795924
Hi Ice123,

The simplest solution is to use the common dialog control. Add this component to your project and place an instance on the form. You can then use the .ShowOpen method to display the standard windows open file dialog and the .FileName property returns the selected file and full path.

Tim Cottee MCSD, MCDBA, CPIM
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9796412
Tims method is the way to do it however if you would prefer to handle this programatically you can enter a path to the desired file, for example

\\Servername\c\Adirectory\Afile
0
 

Author Comment

by:Ice123
ID: 9796525
Thanks TomLaw1999 - I already have that option so any path can be entered.

TimCottee:

Can you please give me an example, I have never dealt with common dialog control before, and am a reasonably new programmer.

thanks.
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 120 total points
ID: 9796592
Ok, in your IDE, choose Project, Components; scroll down till you get to Microsoft Common Dialog Control and check the box next to it to add to your toolbox. Then place this new control on your form. In your code (perhaps for a command button) use:

Private Sub Command1_Click()
    With CommonDialog1
        On Error GoTo errHandler
        .CancelError = True
        .ShowOpen
        MsgBox "File selected was : " & .FileName
    End With
    Exit Sub
   
errHandler:
    If Err.Number = cdlCancel Then
        MsgBox "The selection process was cancelled"
    Else
        MsgBox "Another error occurred"
    End If
End Sub


This will either display the selected file, a message saying you cancelled or that a different error occurred.
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9796759
Listening.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question