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

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

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#

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.

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

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;

Lakshmi Narayanan.S

Regards, Lakshmi Naraayanan.S

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

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