travishaberman
asked on
C#... get file name.
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Get filename with extension
System.IO.Path.GetFileName ([path]);
Get filename without extension
System.IO.Path.GetFileName WithoutExt ension([pa th]);
For example if you wanted to get the name of the HTML in a webBrowser object the path would be:
webBrowser1.URL.AbsolutePa th
System.IO.Path.GetFileName
Get filename without extension
System.IO.Path.GetFileName
For example if you wanted to get the name of the HTML in a webBrowser object the path would be:
webBrowser1.URL.AbsolutePa
something like this
sun4sunday