zoukankan      html  css  js  c++  java
  • saveFileDialog简单使用

                SaveFileDialog sfd1 = new SaveFileDialog();                                                     //定义一个实例
                sfd1.Filter = "excel file (*.xls)|*.xls";                              //设置可选扩展名         
                sfd1.FileName = filename;                                 //默认文件名       
                sfd1.InitialDirectory =  Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //默认文件地址为桌面
                sfd1.RestoreDirectory = true;                                //多次导出保存上次导出时的地址  
                sfd1.DefaultExt = "xls";                                   //默认扩展名
                sfd1.AddExtension = true;                                                                         //如果用户省略,默认添加扩展名
                if (sfd1.ShowDialog() == DialogResult.OK)
                {
                    string filepath = sfd1.FileName.ToString();                        //获取对话框的文件地址和文件名
                    //  label1.Text = filepath;
                    dgtoexcel(dataGridView1, filepath);                            //从datagridview到文件
                }
                else
                    return;
                MessageBox.Show("导出完成");

  • 相关阅读:
    gulp4.0 存在的错误信息 The following tasks did not complete: default,Did you forget to signal async completion?
    高性能前端 art-template 模板
    cookie 详解
    Cross origin requests are only supported for protocol schemes: http, data, chrome,chrome-extension的问题
    jQuery EasyUI 详解
    我的游戏学习日志1——恐龙快打
    我的游戏学习日志2——雪人兄弟
    关于网页导航栏制作的几种方法与常见问题解决(新人向)
    JavaScript基础
    利用CSS3制作网页动画
  • 原文地址:https://www.cnblogs.com/clarklxr/p/10068912.html
Copyright © 2011-2022 走看看