473,503 Members | 4,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DirectoryInfo - Multiple file formats

Hi guyz.

I am using DirectoryInfo to get the list of files from 1 directory and
then display it in grid. I am using ASP.NET with VB.NET code behind.

But I have to pick 2 different kind of files and leave rest alone. The
following code doesn't seem to be working. Where is the wrong
syntex..?

Expand|Select|Wrap|Line Numbers
  1. dgFileList.DataSource = myDirInfo.GetFiles("*.GIF|*.txt")
  2.  
dgFileList is a DataGrid from ASP.NET Can some please help me..?

Cheers.
Jul 21 '05 #1
1 1575
The syntax you've used is used for the filter on dialogs, but is not valid for the GetFiles method

In order to achieve your desired results, you will need to call the GetFiles method twice. Something like this

Dim aFiles as New ArrayLis

aFiles.AddRange(myDirInfo.GetFiles("*.txt")
aFiles.AddRange(myDirInfo.GetFiles("*.GIF")
dgFileList.DataSource = aFile

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1788
by: Subodh | last post by:
Hi, Currently we get data from more then 200 different sources and all of our vendors provide data in different file formats. The problem is we have more then 100 DTS packages now and the...
1
2602
by: Vagabond Software | last post by:
I am recursing through ALL folders and sub-folders below a certain level to list all the files of a certain type in those folders. I use two ArrayLists, alFiles and alFolders, to track matching...
3
2368
by: xenophon | last post by:
This following innocuous code: System.IO.DirectoryInfo fff = new System.IO.DirectoryInfo(); System.IO.FileInfo ppp = fff.GetFiles( Request.MapPath(".") ); for( int ccc=0 ; ccc < ppp.Length ;...
1
320
by: JANEMAN | last post by:
Hi guyz. I am using DirectoryInfo to get the list of files from 1 directory and then display it in grid. I am using ASP.NET with VB.NET code behind. But I have to pick 2 different kind of...
2
2175
by: rn5a | last post by:
Suppose I have the following code: <script runat="server"> Sub Page_Load(.....) Dim dInfo As DirectoryInfo Dim fsi As FileSystemInfo dInfo = New DirectoryInfo(Server.MapPath("Folder1")) ...
1
2597
by: feltra | last post by:
Hi, The following is from my friend who has only restricted net access from his office and hence cannot post.... ...
0
1641
by: feltra | last post by:
Hi all, I am trying to export a GridView data to multiple file formats. The requirement is that when more than one file format is selected and the "Submit" button is clicked, the data from the...
5
6133
by: Tom P. | last post by:
I am having the following problem: I create a FileSystemWatcher and wait for events. When the event does happen I refresh a FileSystemInfo list and set properties accordingly (IsFile, IsDir,...
3
1202
by: Jordan S. | last post by:
I would appreciate your thoughts and opinions on the following: I am looking to render documents into multiple document formats. At a minimum the documents will need to be rendered as HTML, and...
0
7193
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
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7264
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
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6975
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
7449
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...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.