Find the matching file in folder

Hello 
I have a table (datagrid), which contains references .
e.g.
 AZ7854
 AE7415
 AP7871
 AX7125
 BH7607
I also have a folder named Reports that contains several excels files .
the names of Excel files are   like this.
AZ7854-report2013.xlsx
 report2014 - AE7415.xlsx
 12 months report - AP7871.xlsx
 Overview - AX7125.xlsx
 report - BH7607.xlsx
The code that I want to write should be able to recover for each name in Datagrid, the corresponding Excel file. the code must search for each name, the Excel file that contains the reference.
Once the file is found, I think I can do the rest.
Can you help me please ?

The DataGrid's ItemsSource property is set or bound to the "table".
You could cast the ItemsSource property to the type of your collection or DataView and then iterate through all the objects/rows. The following example should give you the idea:
//fill DataGrid with the data:
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("ref"));
dt.Rows.Add("AZ7854");
dt.Rows.Add("AE7415");
yourDataGrid.ItemsSource = dt.DefaultView;
//retrieve the data and find the files:
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@"c:\yourpath\Reports");
System.IO.FileInfo[] files = dir.GetFiles("*.xlsx");
DataView data = yourDataGrid.ItemsSource as DataView;
foreach (DataRowView row in data) {
string val = row["ref"].ToString();
System.IO.FileInfo file = files.FirstOrDefault(f => f.Name.Contains(val));
//do something with the file...
Please remember to close your threads by marking helpful as answer and then start a new thread if you have a new question.

Similar Messages

  • I backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    i backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    Don't you just love changes in interfaces?
    I found the answer to my question.
    When you attach a device (iPhone, iPad) to your Mac, in iTunes 12 in appears as a tiny icon in the second "row" of the iTunes display. Click the icon and the familiar iTunes display for the device appears. From there, on the Summary screen, you can see the dates of the backups of the device (iCloud and backup to the computer). You can also use the button to backup to the computer.

  • Where can i find the 'working files folder' in order to participate in a 'burn & sponge ' tutorial

    I am having trouble finding the working files folder in order to participate in the Dodge - Burn and Sponge 101 tutorial . Do you know where I can locate this please. Best Aaron.

    Probably those files are only available to customers of Infinite Skills...

  • Where do I find the Work Files Folder

    Where do I find the Work Files Folder?

    Do you mean Workspace?  What version of Photoshop?
    Here's the applicable Adobe tech Note for Photoshop CS6:
    http://helpx.adobe.com/photoshop/kb/preference-file-names-locations-photoshop.html
    Welcome to the forums, and for next time:
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers: 
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Anyone have trouble installing blockbuster on-demand app on Mac. My mac downloads the app but i can't seem to find the dowload file in my macHD folder so that I can install the app. I have the OSX version 10.6.8

    anyone have trouble installing blockbuster on-demand app on Mac. My mac downloads the app but i can't seem to find the dowload file in my macHD folder so that I can install the app. I have the OSX version 10.6.8

    Where are you downloading the app from?
    The only one I can find is for iOS based devices >  Blockbuster On Demand for iPhone, iPod touch, and iPad on the iTunes App Store

  • I have downloaded, extracted and installed Elements 12 but it will not open nor can I find the Adobe file in the file where I installed it to..  When I've tried to download and install again

    I have downloaded, extracted and installed Elements 12 but it will not open nor can I find the Adobe file in the file where I installed it to..  When I've tried to download and install again it says that the "Object Already Exists."  It may exists, but it is not visible in the file or in my list of programs on the Startup Menu.

    cactisken
    You should not have to uninstall Premiere Elements 12/12.1 in order to install and run Premiere Elements 13 on the same computer unless your computer is overloaded and the computer resources are compromised. Just use one program at a time.
    Can you still use 12/12.1 on this same computer that will not let you use 13?
    What specific Window operating system are you using?
    Let us go through the usual drill...
    1. Does the problem exist with and without the antivirus and firewall(s) disabled?
    2. Are you using a pen and tablet device instead of a mouse?
    3. Did you install the program with antivirus and firewall(s) disabled?
    4. Disable the SLCache Folder found in Windows 7, 8, or 8.1 64 bit
    Local Disk C
    Program Files (x86)
    Common Files
    Adobe
    and in the Adobe Folder should be the SL Cache Folder that you delete or disable by renaming the Folder
    from SLCache to SLCacheOLD.
    5. Are you running the program as Administrator and is the latest version of QuickTime installed on the same
    computer as Premiere Elements 13?
    Let us start here and then decide what next.
    Thank you.
    ATR

  • How do I find music that has been uploaded to iTunes from a purchased CD and iTunes is "unable to find the original file?" I no longer have the CD. I have tried all the usual methods of looking in my iTunes library and through Find. No Luck.

    How do I find music that has been uploaded to iTunes from a purchased CD and iTunes is “unable to find the original file?” I no longer have the CD. I have tried all the usual methods of looking in my iTunes library and through Find. No Luck.

    Backup drive?
    Subscribe to iTunes Match?
    If neither of the above and you don't have the CD and can't find your tracks on the computer then they you're stuck.  A file recovery utility will cost $100, plus another $100 for an external drive to which to resue the files, and may not even work.  You can buy a lot of CDs for $200.

  • App Module Tester - JBO-33001: Cannot find the configuration file

    I have a custom main function for my application module. Launching the tester is fine
    launchTester("a.b.c.user_mnt.datamodel", "user_mntServiceLocal" );but if I comment out that line and add custom code:
    String amDef = "a.b.c.user_mnt.datamodel";
    String config = "user_mntServiceLocal";
    ApplicationModule am = Configuration.createRootApplicationModule(amDef,config);I get the following error:
    Diagnostics: (BC4J Bootstrap) Routing diagnostics to standard output
    (use -Djbo.debugoutput=silent to remove)
    [00] Diagnostic Properties: Timing:false Functions:false Linecount:true Threshold:6
    [01] CommonMessageBundle (language base) being initialized
    [02] Configuration.loadFromClassPath() failed
    [03] Stringmanager using default locale: 'en_US'
    [04] oracle.jbo.ConfigException: JBO-33001: Cannot find the configuration file
    /a/b/c/user_mnt/common/bc4j.xcfg in the classpathBut the bc4j.xcfg exists in
    /a/b/c/user_mnt/datamodel/common/bc4j.xcfgIs there a way to change where Jdev is looking for that file?
    Thank you,
    Brian

    Completely new workspace doesn't fix the problem.
    If I move the common folder to where jdev is looking it runs fine (I get a runtime error, but it runs none-the-less).
    Any help?
    Brian

  • JboException: JBO-33001: Cannot find the configuration file /common/bc4j.xc

    Hello,
    i'm new on this board and found it while i was searching for an solution of my problem.
    I would like to apologize about my english, i try my best.
    Now lets come to my problem.
    I have 1 workspace with 2 projects.
    in project 1 there are entity objects, view objects and an application object.
    in project 2 there are jsp's action classes and form beans (i try to use Struts).
    in one jsp i try this:
    <jbo:ApplicationModule id="am" configname="*.*.*.bc4j.ReportingModule" releasemode="Stateful" />
    <jbo: DataSource id="ds" appid="am" viewobject="*.*.*.bc4j.HilfeTexteView" />
    <select name="TEXT" size="1">
    <option value="-1" selected>sonstiges</option>
    <jbo:RowsetIterate datasource="ds" changecurrentrow="true">
    <option value="<jbo:ShowValue datasource="ds" dataitem="TEXT"></jbo:ShowValue>">
    <jbo:ShowValue datasource="ds" dataitem="AUTOR"></jbo:ShowValue>
    </option>
    </jbo:RowsetIterate>
    </select>
    <jbo:ReleasePageResources releasemode="Stateful" appid="am" />
    compilation finish successful, but when i try to run this jsp, there appear an error like:
    oracle.jbo.JboException: JBO-33001: Cannot find the configuration file /common/bc4j.xcfg in the classpath
    i think it dont work, because the configuration file bc4j.xcfg is in project 1 folder and i try to take it out of projeck 2 folder
    I hope you know what i try to tell you
    i will be very happy, when somebody could help me.
    greetings
    Rene

    Please refer to other posts for the JboException.
    JBO-33001: Cannot find the configuration file /model/common/bc4j.xcfg
    Accessing BC4J ApplicationModule from another Project

  • JBO-33001: Cannot find the configuration file /Procref/common/bc4j.xcfg

    Migrating project from Jdev 9.031 to Jdev 10.1.2.
    After the migration the app works fine on Jdev 10.1.2, but when deployed to local stand alone OC4J it throws the JBO 33001 error.
    I added dependency of view to the model.
    Checked the existense of bc4j.xcfg in the classes.
    I also ran the ADF Runtime installer as per the recommendations.
    Any suggestions.....
    The complete statck trace of the error is
    oracle.jbo.JboException: JBO-33001: Cannot find the configuration file /Procref/common/bc4j.xcfg in the classpath
         at oracle.jbo.client.Configuration.loadFromClassPath(Configuration.java:358)
         at oracle.jbo.common.ampool.PoolMgr.createPool(PoolMgr.java:281)
         at oracle.jbo.common.ampool.PoolMgr.findPool(PoolMgr.java:482)
         at oracle.jbo.common.ampool.ContextPoolManager.findPool(ContextPoolManager.java:165)
         at oracle.jbo.http.HttpContainer.findSessionCookie(HttpContainer.java:817)
         at oracle.jbo.html.jsp.datatags.ApplicationModuleTag.doStartTag(ApplicationModuleTag.java:169)
         at index.jspService(_index.java:73)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
         at gov.mi.mdch.procref.MainController.processRequest(MainController.java:53)
         at gov.mi.mdch.procref.MainController.doPost(MainController.java:39)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)

    This is the same problem I am having. The "Model" product contains the AppModule and it's entity and view objects.
    I right-clicked on the AppModule and chose "Business Components Deployment". This created in the Resources folder a Model.bcdeploy, which contained ModelMiddleTier1.deploy and ModelCommon1.deploy.
    When I went to the project properties of my "WS" project in the same workspace, in the Dependencies panel, Model.bcdeploy and its 2 .deploy files were now listed bewas now listed beneath model.jpr. There is a check mark beside model.jpr. I thought this would do it.
    I then recreated the "J2EE Web Service" from class file in the WS project, and deployed to the external OC4J.
    When I test the web service using OC4J's test facility, I still get the same JBO-33001 error complaining that the adfws/model/common/bc4j.xcfg file is not in the classpath.
    Does something else need done to get it to be found at run time?
    This is JDev 10.1.3.
    Thanks for any ideas.
    Morga

  • Cannot find the class file

    Hi All,
    Can any one help me regarding the issue?
    Error:
    package com.support.misc.feedback
    I am getting the following error for the above line. But I have created the Hierarchy in folder structure. But still it is throwing the error.
    1. Cannot find the class file for com.sapportals.htmlb.page.DynPage
    2. This compilation unit indirectly references the missing type com.sapportals.htmlb.page.DynPage (typically some required class file is referencing a type outside the class path)     FeedbackBean.java
    Thanks in Advance.
    Message was edited by: Gowsika Kannan

    Hi Gowsika,
    the class needed is located in htmlb.jar which can be found under <irj-root>/WEB-INF/portal/portalapps/com.sap.portal.htmlb/lib
    You need to integrate this jar in your .classpath
    Hope this helps,
    Robert
    PS: Please do not post the same question 3 times

  • EA Could Not Find The .html File Associated With...

    After naming folder names, I now get the "EA could not find the .html file associated with..." message when I open the .edge file. When I open the .an file, I have all elements and the timeline are gone! How can I restore it? Surely, it is just a question of changing a path, or? Please help. Thanks!

    From the File > Open menu, browse to the that same folder (the newly renamed one), and select the .html file.
    Darrell

  • IWeb works, but I can't find the domain file!!!!

    OK - this one has had me stumped for a few days now... I have iWeb (vs. 1.1.2 - from the '06 iLife). I need to find the domain file. It isn't in the home/library/app. support/iWeb folder. I didn't move it. I searched for it using command-F and using spotlight on my computer.
    iWeb is to reset and start from scratch if there isn't a domain file on your hard drive. So I know it's there somewhere (at least, I think it is?). My site is there. I can publish. I can make changes, however I can't find the domain file to make a back up of it. I don't think that I made it invisible - could I have somehow done that? And if so, is it possible to find it? I believ the program only works if the file is named "domain" so I don't think that I could have accidentally renamed it.
    Is there someone out there who can help me? I don't want to have to start from scratch and rebuild the websites.
    Thanks for your input!

    This is from Multisite's Technical Page:
    Technical Information
    While you don’t need to understand how data is stored to use Multisite for iWeb it can be helpful occasionally to understand what is going on behind the scenes. At a nuts and bolts level Multisite for iWeb stores all of its sites in your home folder’s Documents folder in a single package (which is really a fancy folder dressed up to look like a file) called “Multisite for iWeb Data.mfi.”
    You can open that package like this.
    Once you get your domain file straightened out I'd definitely get Varkgirl's Automator application to make frequent backups of that file. You can get it Varkgirl's iWeb Tips and Tricks site.

  • How to find the unused files for deletion?

    After mapping 600 xml files, how does one find the unused files for deletion from the folder? (eaiser and cheaper translations)
     

    iWeb will open any file with the extension .sites2 - it doesn't have to be named "Domain".
    See this page for how to open separate Domain files when using Lion/Mountain Lion...
    http://www.iwebformusicians.com/iWeb/mountain-lion.html
    The above page will also let you know how to find the library folder now that its hidden.

  • Where can I find the backup files in iTunes for my iPhone, I want a copy

    Where can I find the backup files in iTunes for my iPhone, I want to copy the backup files for all app's and phone numbers, I'm using Windows XP
    I just need to know where its hiding, a link that shows an address where would sure help

    First you'll need to make sure your XP is set up to view hidden files and folders.
    1. Open My Computer from the desktop or Start menu.
    2. In the Tools menu, click Folder Options.
    3. Click the View tab.
    4. In the "Advanced settings" pane under "Hidden files and folders" make sure that the "Show hidden files and folders" option is selected.
    5. Click OK.
    Now you should be able to track down your backup file at the location in the following document:
    [iTunes: "Backup could not be saved on the computer" alert message|http://support.apple.com/kb/TS2529]

Maybe you are looking for

  • Can I store my iPhoto library on an external hard drive?

    My iPhoto library has become very large and I would like to tranfer it over to my hard drive. Can I copy my iPhoto library over to the drive and then delete it from my system hard disk without loosing my photos? And, when I import photos, where will

  • [SOLVED]Sound issue - xine was unable to initialize any audio drivers.

    When I booted this morning the computer showed that arts died and blabla messages, and when I started Amarok I got this nasty error that I occasionally get when I am not in the 'audio' group: xine was unable to initialize any audio drivers. But I am

  • Non Unique Indexes on Dimension Table

    Hello ,   I have Material Dimension that has Product MainGroup, Brand , SPC code broken from Product Hierarchy.   As per Business Requirement , we don't want to use the Product Hierarchy , that should need to split into 3 pieces.   Since The Cube Dim

  • Is there an online tutorial for IPhone 4?

    Is there an online tutorial for using the IPhone 4?  I just got one and could use some help to get started with it.

  • Trust (external system and SAP)

    Hi guys, As part of a SAML scenario i need to establish trust between an external system and SAP PI (7.10) allowing the external system to send WS requests to SAP. As per my understanding all I need to do is import the certificate chain into STRUST o