Solved

C#... get file name.

Posted on 2007-03-20
6
2,559 Views
Last Modified: 2008-02-01
Hi Experts,

I have a infoPath file that has a button on it - if you are not familiar with infopath you may still be able to help me.  I just need to retrive the filename of the infopath form using c#.  That is, when the button is pressed I need the code run underneith the button to retrieve the filename of the form.  If you are not familiar with infopath, I you may be able to help me by telling me how one would do this if the button were set up on some other type of file that you are familiar with.

Thanks,

-TH
0
Comment
Question by:travishaberman
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
sun4sunday earned 500 total points
ID: 18761637
GetFilename method may help you
http://www.codeproject.com/csharp/dandtutorial.asp

sun4sunday
0
 
LVL 9

Expert Comment

by:sun4sunday
ID: 18761648
System.IO.Path.GetFileName(FILE_PATH)

something like this

sun4sunday
0
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 18762523
Get filename with extension
System.IO.Path.GetFileName([path]);

Get filename without extension
System.IO.Path.GetFileNameWithoutExtension([path]);

For example if you wanted to get the name of the HTML in a webBrowser object the path would be:
webBrowser1.URL.AbsolutePath
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Greetings C# program 17 107
C# parent child form 5 28
Reccomended programming language for client-server applications 12 97
How come this regular expression allows "e"? 14 38
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The viewer will learn how to implement Singleton Design Pattern in Java.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question