views:

95

answers:

1

I import a file, process it and save it in some location. I am saving my file in a folder but it is getting saved in a folder above the folder selected. Here is the code,

    private void btnSave_Click(object sender, EventArgs e)
    {
        FolderBrowserDialog saveFile = new FolderBrowserDialog();
        saveFile.ShowNewFolderButton = true;
        if (saveFile.ShowDialog(this) == DialogResult.OK)

        {
            btnStartImport.Enabled = true;
            txtSaveBookName.Text = saveFile.SelectedPath;
            string r = Path.GetFileNameWithoutExtension(m_ImportFile);
            m_SaveDir = (txtSaveBookName.Text + r);

        }
    }

m_ImportFile gives the path of the file from where we get the input file, i want my saved file to be of the name of the m_ImportFile.extension that i want to save it in. but by this method i am getting the folder that i select.name of the m_ImportFile.extension i want. Eg. I import a file chh.xml, so when i want to save it i want to get chh.xuk but if i select a folder ab then the path of saved file if ab.chh.xuk and that too in a folder above the selected folder. Please help.

+1  A: 

Try:

m_SaveDir = Path.Combine(txtSaveBookName.Text, r);
Johan Kullbom