public void ButtonClick(object sender, EventArgs e) { //check if it's a valid SpatiaLite layer OpenFileDialog fd = new OpenFileDialog(); fd.Title = "Open SpatiaLite database"; fd.Filter = "SpatiaLite database|*.sqlite"; if (fd.ShowDialog() == DialogResult.OK) { string cs = SQLiteHelper.GetSQLiteConnectionString(fd.FileName); bool isValidSchema = SpatiaLiteHelper.CheckSpatiaLiteSchema(cs); if (!isValidSchema) { MessageBox.Show("The database " + fd.FileName + " is not a valid SpatiaLite database. Table geometry_columns not found."); return; } else { frmAddLayer frm = new frmAddLayer(cs, App.Map); frm.Show(); } } }