URGENT: File Control

I am looking for a file control, which is data aware .... if possible the control must have the ability to select a file, store the filename, and have buttons which will open the file using the default application (if any).

Are there any such beasts available as a free user control ?

MTIA in anticipation ....

Who is Participating?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
not that I know of.
you should take the normal text control to show and store the filename, and add 2 buttons to browse for the filename (by using the common dialog control for example) resp. open the file (using ShellExecuteEx API).
dwe0608Author Commented:
thanks for the quick response ...

Yes I agree thats what has to happen ... but I thought I would maybe not have to reinvent the wheel .... someone must have done this some where ...

see what happens ...

Guy Hengel [angelIII / a3]Billing EngineerCommented:
as this process is only tying together 3 small parts, I don't see the interest in doing it a separate control, but you can create a UserControl in your project if you use that at several occasions...
Just put a textbox and a commandbutton on your form, then try the following code:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
    Call ShellExecute(0&, vbNullString, Text1.Text, vbNullString, "C:\", 1)
End Sub

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.