I work in c# visual studio 2015 windows form
I have two forms
CreateDatabase Form
Form1 form
I need when open my application to check IF Excel file exist or not
IF Excel file not exist go to form CreateDatabase Form if excel file not exist
And
IF excel file database exist before open form1
How to do that please
what i try as following :
in form1 load event i write following code
- CreateDatabase frm = new CreateDatabase();
- var fileName = string.Format("{0}\\Book3105.xlsx", Directory.GetCurrentDirectory());
- if (!File.Exists(fileName))
- {
-
- Form1 frm1 = new Form1();
- frm.Show();
- frm1.Hide();
-
-
- }
- else
- {
-
-
- frm.Hide();
- this.Show();
- }