473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

searching using a folderbrowserdialog

OK i have been looking for some help on a program i am writing i am supposed to use a folderbrowserdialog but i cant seem to get it to let me search with it and then save to a new place can some one help
Mar 13 '07 #1
11 3615
shweta123
692 Expert 512MB
Hi,

Can you please specify your Coding if you are getting any error?

You can search using
FolderBrowserDialog1.showDialog

And get the path selected using
FolderBrowserDialog1.SelectedPath
Mar 13 '07 #2
Hi,

Can you please specify your Coding if you are getting any error?

You can search using
FolderBrowserDialog1.showDialog

And get the path selected using
FolderBrowserDialog1.SelectedPath
i am not erroring out i cant find the code to get it to do anything
here is the code:

Private Sub Buttonsource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsource.Click
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
TextBoxXSource.Text = FolderBrowserDialog1.SelectedPath
End If
If CheckBoxsearch.Checked Then
Else
End If
End Sub

The if and else are for a check box
Mar 13 '07 #3
i made it unclear i mean searching for certian file types using the folderbrowserdialog
Mar 13 '07 #4
Prose
20
i made it unclear i mean searching for certian file types using the folderbrowserdialog
Try This: Not sure if it will work.. but im trying to help none the less lol

Expand|Select|Wrap|Line Numbers
  1.         Dim FolderBrowser As New FolderBrowserDialog()
  2.         FolderBrowser.Filter = "Text Files (*.txt)|.txt"
  3.  
TextFiles is just an example i used...u can replace this with any kind of file.. such as .doc ------ "Word Document (*.doc)|.doc" again just an example, replace the FolderBrowser.Filter with the file type u want to use!

Note: i have not tried this!.. im currently on a computer that doesnt have VB installed.. soo im not all too sure it's just a theory.. lol.. but i hope it helps

Good Luck!

Prose.
Mar 14 '07 #5
i am retreiving the file types from a text box adn was trying to get the text box to set the filter its a windows app version of this web app http://www.xefteri.com/articles/show.cfm?id=16
Mar 14 '07 #6
Expand|Select|Wrap|Line Numbers
  1. ''' <summary>
  2. ''' this program take differnt files and moves them form one directory to another 
  3. ''' </summary>
  4. ''' <remarks></remarks>
  5. Public Class Formsource
  6.     ''' <summary>
  7.     ''' a search for files of a certain type in the directories 
  8.     ''' </summary>
  9.     ''' <param name="sender"></param>
  10.     ''' <param name="e"></param>
  11.     ''' <remarks></remarks>
  12.     Private Sub Buttonsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsearch.Click
  13.         If CheckBoxsearch.Checked = True Then
  14.             'search the sub directories and the directories
  15.         Else
  16.             'search only the directories
  17.         End If
  18.     End Sub
  19.     ''' <summary>
  20.     ''' look for the source of the file to copy 
  21.     ''' </summary>
  22.     ''' <param name="sender"></param>
  23.     ''' <param name="e"></param>
  24.     ''' <remarks></remarks>
  25.     Private Sub Buttonsource_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsource.Click
  26.         If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
  27.             TextBoxXSource.Text = FolderBrowserDialog1.SelectedPath
  28.         End If
  29.         If CheckBoxsearch.Checked Then
  30.         Else
  31.         End If
  32.  
  33.     End Sub
  34.     ''' <summary>
  35.     ''' looks for the destiantion of the files
  36.     ''' </summary>
  37.     ''' <param name="sender"></param>
  38.     ''' <param name="e"></param>
  39.     ''' <remarks></remarks>
  40.     Private Sub Buttondes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttondes.Click
  41.         If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
  42.             TextBoxXdestination.Text = FolderBrowserDialog1.SelectedPath
  43.         End If
  44.     End Sub
  45.     ''' <summary>
  46.     ''' a button to exit 
  47.     ''' </summary>
  48.     ''' <param name="sender"></param>
  49.     ''' <param name="e"></param>
  50.     ''' <remarks></remarks>
  51.     Private Sub Buttonexit_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonexit.Click
  52.         End
  53.     End Sub
  54. End Class
  55.  
Here is the code i have even a search button adn a save button for searching adn saving i just need to know how to get the save button to save what i search and find and i need the search button to search trhough directories and sub directories
Mar 14 '07 #7
Expand|Select|Wrap|Line Numbers
  1. ''' <summary>
  2. ''' this program take differnt files and moves them form one directory to another 
  3. ''' </summary>
  4. ''' <remarks></remarks>
  5. Public Class Formsource
  6.     ''' <summary>
  7.     ''' look for the source of the file to copy 
  8.     ''' </summary>
  9.     ''' <param name="sender"></param>
  10.     ''' <param name="e"></param>
  11.     ''' <remarks></remarks>
  12.     Private Sub Buttonsource_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsource.Click
  13.         If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
  14.             TextBoxXSource.Text = FolderBrowserDialog1.SelectedPath
  15.         End If
  16.         If CheckBoxsearch.Checked Then
  17.         Else
  18.         End If
  19.  
  20.     End Sub
  21.     ''' <summary>
  22.     ''' looks for the destination of the files
  23.     ''' </summary>
  24.     ''' <param name="sender"></param>
  25.     ''' <param name="e"></param>
  26.     ''' <remarks></remarks>
  27.     Private Sub Buttondes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttondes.Click
  28.         If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
  29.             TextBoxXdestination.Text = FolderBrowserDialog1.SelectedPath
  30.         End If
  31.     End Sub
  32.     ''' <summary>
  33.     ''' a button to exit 
  34.     ''' </summary>
  35.     ''' <param name="sender"></param>
  36.     ''' <param name="e"></param>
  37.     ''' <remarks></remarks>
  38.     Private Sub Buttonexit_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonexit.Click
  39.         End
  40.     End Sub
  41.     ''' <summary>
  42.     ''' this button will search and save any file of the specified type 
  43.     ''' </summary>
  44.     ''' <param name="sender"></param>
  45.     ''' <param name="e"></param>
  46.     ''' <remarks></remarks>
  47.     Private Sub Buttonsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsave.Click
  48.         With FolderBrowserDialog1
  49.             .Description = "Select your folder"
  50.             .RootFolder = Environment.SpecialFolder.MyDocuments
  51.             .ShowNewFolderButton = True
  52.             If .ShowDialog() = Windows.Forms.DialogResult.OK Then
  53.                 MsgBox(.SelectedPath)
  54.             End If
  55.         End With
  56.     End Sub
  57. End Class
Code has changed as you can see i just need it to now search the sub if the check box is checked
Mar 20 '07 #8
SammyB
807 Expert 512MB
This is how I would design it:

At the top of the form there are two textboxes for the input and output directories. After each textbox there is a browse button that uses the FolderBrowseDialog.

Under that there are two panels:

Left is a CheckedListBox that you populate with a unique list of the file extensions in the input directory.

Right is a ListView (with checkboxes) that lists all of the files whose extensions are checked.

Both lists should initially be all checked; ie move the entire directory. The CheckedListBox click event would update the File list. The OK button prompts "are you sure?" and then moves the checked files from the input directory to the output directory.

In addition, use an ErrorProvider control to prohibit the user from clicking OK until the input & output directories have been chosen.

What do you need help with?
Mar 20 '07 #9
i need it to search the directories for a certain file type and move it to the destination folder
Mar 20 '07 #10
SammyB
807 Expert 512MB
>search the directories for a certain file type

Use Directory.GetFiles
See http://msdn2.microsoft.com/en-us/library/wz42302f.aspx

>move it to the destination folder

Use File.Move
See http://msdn2.microsoft.com/en-us/lib...file.move.aspx
Mar 22 '07 #11
>search the directories for a certain file type

Use Directory.GetFiles
See http://msdn2.microsoft.com/en-us/library/wz42302f.aspx

>move it to the destination folder

Use File.Move
See http://msdn2.microsoft.com/en-us/lib...file.move.aspx
That is what i am trying to get it to do thanks i am inserting the code as we speek
Mar 22 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anja | last post by:
I have installed the new Visual Studio 2003 and implemented the FolderBrowserDialog. Everything works fine, if I open the FolderBrowserDialog before opening a Database Connection. If I open...
25
by: | last post by:
Hi, The following code shows the FolderBrowserDialog = broken. FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.ShowNewFolderButton = false;...
0
by: R A | last post by:
Hi, I use FolderBrowserDialog in my c# windows forms project. It was working with no issues, but right now the dialog shows but I can't see any directories selection. I can see the buttons at...
4
by: MikeY | last post by:
Hi Everyone, I'm getting stumped here. I've been trying to use the FolderBrowserDialog for the first time, but to no avail. Can someone please give me adive on how to use this. I don't know if I...
12
by: JohnR | last post by:
I have narrowed a problem down to a simple example. A form with two buttons. One EXIT and one FBD. The exit button does an "END" to end the application. The FBD button does a...
4
by: hotmit | last post by:
I'm trying to create a program that dynamicly saves and loads path of a FolderBrowserDialog , but I ran into a problem. Since FolderBrowserDialog is not a Control, therefore it doesn't have...
3
by: antuantuan | last post by:
Hi. How can I initialize a FolderBrowserDialog choosing a particular RootFolder? I saw that FolderBrowserDialog has a RootFolder member, but it accepts only an Environment.SpecialFolder (but I...
6
by: chrisknapp | last post by:
I'm learning VB and am making an application where I need a user to be able to choose which folder his files are located in. The folder path chosen will be stored as a string for later use in the...
4
by: Jerry West | last post by:
I'm trying to set the .RootFolder property of the FolderBrowserDialog object. Each time I try I get an error stating: "Object reference not set to an instance of an object." I have not opened...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.