.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to remove Drive Name

Posted By: chandrakant     Posted Date: May 05, 2011    Points:5   Category :C#
Hi

i have one application it contains one Textbox and Browse Button when i browse some folder from the path, it will show that folder name in textbox but if i select the only D:\ Then It will Show in TextBox but i want to remove that when i choose the Drive only. means if i select drive only then it will not work how to do please help me.





Responses
Author: Narayanan             
Posted Date: September 09, 2011     Points: 20   

Hi,
try this way...
using System.IO;
DialogResult Result = openFileDialog1.ShowDialog();
if (Result == DialogResult.OK)
{
String Paths = openFileDialog1.FileName.ToString();
string Fname = Path.GetFileName(Paths);
textBox1.Text = Fname;
}

Regards,
Lakshmi Narayanan.S

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend