导出dataGridView 的数据到EXCEL 中
         private void button2_Click(object sender, EventArgs e)
         {
             Productdiscount pd = new Productdiscount();
             Serviceinformation si = new Serviceinformation();
             if (MessageBox.Show("您确定要导出吗?", "提示",
                      MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
             {
                 ExportDate ep = new ExportDate();
                 ep.dgvOutPutExcel(dataGridView1);这个有值
                 ep.dgvOutPutExcel(pd.dataGridView1);我断点看了这个没有值
                 ep.dgvOutPutExcel(si.dataGridView1);我断点看了这个没有值
这是为什么。知道的代码简略打下
             }
------解决方案--------------------
Productdiscount pd = new Productdiscount();
 Serviceinformation si = new Serviceinformation();
你这里new了两个新的对象,新对象里面的dataGridView和已经有数据的dataGridView不是一个
------解决方案--------------------