|
-
Jun 9th, 2004, 03:49 PM
#1
Thread Starter
Frenzied Member
(VB BUG?) Testing Folder & File Browser ...
NEWBIE ALERT!!!
Esteemed Forum Participants and Lurkers:
I an making my first attempt at using Folder and File selection Dialog Boxes. I know that I do not have to use BOTH, but I'm just playing with this primitive test just want to see how they both work.
I have one panel with one text box for the File Spec. Just to get started, double clicking on the text box is the event to open the path and then the file selection dialogs.
It all seems to work EXCEPT ... the Folder Dialog box SHOWS the "New Folder" button, and the code sets
ShowNewFolderButton = False.
I can NOT get the dialog to pop up without the New Folder button.
Here is the code:
Code:
' Text Box Component for File Name Selection
Private Sub q_SourcePath_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles q_SourcePath.DoubleClick
' Create an instance of the Folder Browser Popup Modal Dialog Box
Dim FolderBrowserDialog1 As New FolderBrowserDialog
' Create an instance of the File Browser Popup Modal Dialog Box
Dim OpenFileDialog1 As New OpenFileDialog
' SETUP THE FOLDER BROWSER
' This is the descriptive text in the Folder Select Dialog Box
FolderBrowserDialog1.Description = "Select the Folder where the files are located"
' This is the default path for the Folder Browser
FolderBrowserDialog1.SelectedPath = "C:\Test\MyFiles\"
' Do NOT allow a new folder to be created in this dialog
FolderBrowserDialog1.ShowNewFolderButton = False
' SETUP THE FILE BROWSER
' OpenFileDialog1.ShowHelp = False (False is the default)
' OpenFileDialog1.DefaultExt = "pdf" (Do this with the filter)
' Select only PDF files
OpenFileDialog1.Filter = "Select ONE prototype file|*.pdf"
' Do NOT allow selection of multiple files
OpenFileDialog1.Multiselect = False
' Execute the Folder Browser
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
' Put the selected Folder path in the Source Path Text Box
q_SourcePath.Text = FolderBrowserDialog1.SelectedPath
End If
' Pass the Folder path to be the default path for the File Browser
OpenFileDialog1.InitialDirectory = q_SourcePath.Text
' Execute the File Browser
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
' Put the selected File Spec in the Source Path Text Box
q_SourcePath.Text = OpenFileDialog1.FileName
End If
' To do or not to do ... that is the question.
' These lines are probably totatlly superfluous since the instances
' of the Dialog boxes are local to this subroutine.
FolderBrowserDialog1.Dispose()
OpenFileDialog1.Dispose()
End Sub
I would appreciate any and all comments regarding this snippet, ESPECIALLY why the "NewFolderButton" persists when it is supposed to be "OFF".
Last edited by Webtest; Jun 11th, 2004 at 07:15 AM.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|