【C#学习】保存对话框 saveDialog

private void Export(int type)
{
   System.Windows.Forms.SaveFileDialog sfd = new SaveFileDialog();
   sfd.FilterIndex = type;
   sfd.Filter = "Excel文件(*.xlsx)|*.xlsx|STK文件(*.plc,*.plc3)|*.plc";
   if (sfd.ShowDialog() == DialogResult.OK)
  {
   //FilterIndex represent which format you choose.
   switch (sfd.FilterIndex)
   {
     case 1: 
         ExcelOperation myExcel = new ExcelOperation();
               myExcel.DoExport(listView1, sfd.FileName);
         break;
     case 2:break;
    }
  }
}

你可能感兴趣的:(编程技术,c#,学习,开发语言)