创建的文件已保存在分配的路径上,但无法找到创建的文件

时间:2019-07-03 05:30:59

标签: c# directory savefiledialog

对于C#的“保存文件”对话框,我有点困惑,我试图将创建的文件保存在使用“保存”对话框声明的专用目录中,程序将运行而没有错误,当我尝试执行以下操作时检查文件夹,创建的文件不存在。你能检查一下我是否在这里缺少什么吗?

            string description1 = "data table test";
            string description2 = "description2";
            string description3 = "description3";
            Int32 chartType = 1;
            Int32 sampleSize = 1;
            Int32 decimalPlace = 3;
            Int32 opportunities = 3;
            Int32 numOfID = 12;
            Int32 numOfNote = 0;
            Int32 shortRun = 1;
            Int32 pareto = 1;
            double USL = 1;
            double NOM = 1;
            double LSL = 1;
            double upperGate = 0;
            double lowerGate = 0;

            int Createtable= S2KDLL.S2K_CreateDataTable(datatableName, description1, description2, description3, chartType, sampleSize, decimalPlace, opportunities, numOfID, numOfNote, shortRun, pareto, USL, NOM, LSL, upperGate, lowerGate);
            if (Createtable == 0)
            {

                MessageBox.Show("Data Table has been created");
                textBox2.Clear();



                SaveFileDialog SaveFileDialog1 = new SaveFileDialog();
                SaveFileDialog1.FileName = textBox2.Text;
                SaveFileDialog1.InitialDirectory = @"C:\Synergy2k_Data Table";
                SaveFileDialog1.Filter = "Synergy2000 Data Table file (*.ztb) | .ztb";

                if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                MessageBox.Show("File has been save to your local drive"); 
                }


            }
        }

0 个答案:

没有答案