private void button6_Click(object sender, EventArgs e) { createbill1 ss = new createbill1(v); ss.Show(); this.Hide(); }
public Form1(int s) { v = s; InitializeComponent(); try { string path = " "; // this is the path that you are checking. if (v == 1) { path = @"C:\Program Files (x86)\YatinPatel\BillingSoft. Setup\data LB.xlsx"; } else { path = @"C:\Program Files (x86)\YatinPatel\BillingSoft. Setup\data RP.xlsx"; } con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0"); da = new OleDbDataAdapter("select * from [sheet1$]", con); da.Fill(data); if (v == 1) { path = @"C:\Program Files (x86)\YatinPatel\BillingSoft. Setup\BILL LB.xlsm"; } else { path = @"C:\Program Files (x86)\YatinPatel\BillingSoft. Setup\BILL RP.xlsm"; } openFileDialog2.FileName = path; } catch (Exception ex) { MessageBox.Show("can't load select meanullay"); } this.Hide(); createbill1 ss = new createbill1(openFileDialog2.FileName.ToString(), data, text1, text2, text3, text4, v); ss.Show(); }