how to extract the file name & the File Path?
  • hi experts i share some code . it may helps you
    how to extract the file name and path name 
                   string PathName;
                    string filename;
                    string dbf_File;
                    if (FileTypeCmboBox.Text == "Excel")
                    {
                        DCRFileDialog.Filter = "Excel Files(.xlsx)|*.xlsx| Excel Files(.xls)|*.xls| Excel Files(*.xlsm)|*.xlsm";
                        if (DCRFileDialog.ShowDialog() == DialogResult.OK)
                        {
                            dbf_File = DCRFileDialog.FileName; //Whole Path name
                            PathName = System.IO.Path.GetDirectoryName(dbf_File); //here you get the path name except selected File Name
                            filename = Path.GetFileName(dbf_File);// Here you get only the File name
                            FileNametxtBox.Text = filename;
    PatheNametxtBox.Text=dbf_File ; // or as your wish if you want the whole path name or path name except selected File Name
                           PatheNametxtBox.Text=PathName 

                        }

                    }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Optimum Creative