Esempio n. 1
0
        public FrmPrograms(string fa)
        {
            fileName = fa;

            InitializeComponent();
            filePath = Application.StartupPath + "\\data\\" + fileName;
            if (File.Exists(filePath))
            {
                ProfileHelper.ReadExcel(filePath, dataGridView1);
                //      XMLHelper.ReadXMLdata(filePath, ref dataGridView1);
            }

            metroTabPage1.Text = fa;
        }
Esempio n. 2
0
        //  string xml_FilePath = "";//用来记录当前打开文件的路径的
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();//一个打开文件的对话框

            //   openFileDialog1.Filter = "xml文件(*.xml)|*.xml";//设置允许打开的扩展名
            try
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)//判断是否选择了文件
                {
                    ProfileHelper.ReadExcel(openFileDialog1.FileName, dataGridView1);
                    //XMLHelper.ReadXMLdata(openFileDialog1.FileName, ref dataGridView1);
                    metroTabPage1.Text = Path.GetFileNameWithoutExtension(openFileDialog1.FileName); //openFileDialog1.FileName;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }