Click here to Skip to main content
15,910,009 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In run mode as follows

Course Type REO 5 Days(textbox1)

I have one folder in D path. in D drive file as follows

REO 5 Days.htm

I want to validate REO 5 Days textbox1 value and D drive file name REO 5 days must be the same.


for that how can i validate using c#.
Posted

1 solution

C#
string path = "C:\\stagelist.txt";

 string extension = Path.GetExtension(path);
 string filename = Path.GetFileName(path);
 string filenameNoExtension = Path.GetFileNameWithoutExtension(path);
 string root = Path.GetPathRoot(path);

O/P
C#
.txt
stagelist.txt
stagelist
C:\

now compare file name with the text box..
Link..
http://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900