473,569 Members | 2,791 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 1587
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.GetF iles("*.txt")
aFiles.AddRange (myDirInfo.GetF iles("*.GIF")
dgFileList.Data Source = aFile

Jul 21 '05 #2

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

Similar topics

2
1792
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 maintainance is very diffucult. Every time our vendor changes the format we have to change in multiple DTS packages. Is anybody know what would be the...
1
2603
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 files and my progress in the recursion. I use a while loop to manage the folder-subfolder drill-down. Each pass through the while loop creates a new...
3
2374
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 ; ccc++ ) { System.Web.HttpResponse.Response.Write( "<a href=\"" + Request.MapPath(".") + "/" + HttpUtility.HtmlEncode(ppp.Name) + "\">link</a>" );
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 files and leave rest alone. The following code doesn't seem to be working. Where is the wrong syntex..?
2
2177
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")) For Each fsi In dInfo.FileSystemInfo
1
2606
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.... -------------------------------------------------------------------------------------------------- I am trying to export a GridView data to multiple file formats. The requirement is that when more than one file format is...
0
1648
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 grid needs to get exported to multiple file formats. First of all is it possible? I am using ASP.NET 2.0 and VS 2005. If possible can you give me any...
5
6136
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, ReadOnly, etc.). The problem I'm having is in identifying when a FileSystemInfo entry is a FileInfo or a DirectoryInfo type. I get the rare, and yet...
3
1206
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 separately as PDF. Ideally we could also offer a subset additionally as xls and docx (Excel and/or Word 2007) files. All files will be...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.