[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

C#... get file name.

Posted on 2007-03-20
6
Medium Priority
?
2,582 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
sun4sunday earned 2000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

656 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