473,394 Members | 1,224 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,394 software developers and data experts.

Any controls for Folder selection Not File. When I click "Browse"

Hello VB Developers....


I like to select a folder, by clicking a button.

I am using common dialog box for this. But it selects only file.

Also I need code to list of xml file to list into list box contains the selected folder.

Thanks.
vishwa Ram.
Jun 2 '07 #1
1 1411
You need to be more specific with your help questions. State whether you're using VB6 or .NET, not just what you want to do. It's real easy to do it in .NET:

Expand|Select|Wrap|Line Numbers
  1.         'set the folder browser
  2.         Dim folderBrowser As New FolderBrowserDialog
  3.  
  4.         'open the dialog and if the user presses OK...
  5.         If folderBrowser.ShowDialog And Windows.Forms.DialogResult.OK Then
  6.  
  7.             'set the directory info for the selected folder
  8.             Dim dirInfo As New System.IO.DirectoryInfo(folderBrowser.SelectedPath)
  9.  
  10.             'clear the listbox
  11.             ListBox1.Items.Clear()
  12.  
  13.             'iterate through the files in the selected folder...
  14.             For i As Integer = 0 To dirInfo.GetFiles.Length - 1
  15.                 'if the extension is xml...
  16.                 If LCase(System.IO.Path.GetExtension(folderBrowser.SelectedPath & "\" & _
  17.                 dirInfo.GetFiles.GetValue(i))) = ".xml" Then
  18.                     'list them in the listbox
  19.                     ListBox1.Items.Add(dirInfo.GetFiles.GetValue(i))
  20.                 End If
  21.             Next
  22.         End If
  23.  
I hope that's what you're looking for. Reply if it works or not.
Jun 3 '07 #2

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

Similar topics

21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
11
by: laredotornado | last post by:
Hello, Is it possible, instead of having the button "Browse" for the HTML <input type="file"> element, to have a graphic in its place? How would this be done? Thanks, - Dave
3
by: Olivier Verdin | last post by:
Hi, I am developing a multi-language application in ASP.NET in c#. I am using a file field html control to upload an image. I would like to change the text on the button "browse" that comes...
3
by: Rico | last post by:
Hello, Is there any kind of Browse dialog available? I currently use an Open File dialog which is great for selecting files, but sucks (it's confusing) when you're trying to set a directory...
4
by: acord | last post by:
Hi, I want to change the name of Browse to Add... How can I modify the followoing html code? <form name="iform" action="" method="post" enctype="multipart/form-data"> <input id="file"...
9
by: Prakash Singh Bhakuni | last post by:
am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice. Any ideas on why this is happening...
9
by: Roger Withnell | last post by:
I am building a website in Russian. What options do I have to make the "Browse" button display in other languages? Thanking you in anticipation. Posted Via Usenet.com Premium Usenet...
1
by: aby004 | last post by:
Hello Sir, I want to know that how to create a "Browse" button to upload file to server ? i have already creating a attachfile button and applying a script, but there is no respone when...
6
by: skyy | last post by:
Hi.. i am doing file upload using CGI perl scripts... I want to allow the user to select the files using the "Browse" button only instead of typing the path name. How i do it? Thanks.....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.