static void Main() { conn = new SqlCeConnection(); conn.ConnectionString = @"Data Source='Database1.sdf'"; conn.Open(); Application.SetCompatibleTextRenderingDefault(false); Main_fm mainForm = new Main_fm(conn); Application.EnableVisualStyles(); Application.Run(mainForm); mainForm.FormClosing += form_closing; }