Exemplo n.º 1
0
        //on load do this.
        private void Main_Load(object sender, EventArgs e)
        {
            try
            {
                //using SelectRows method to grab data safely.
                DataSet personDataSet = new DataSet();
                personDataSet            = Handlers.RetrieveSQLData(personDataSet, DataStrings.SqlConnectionString(), DataStrings.DGVMainFormDataQuery());
                dgvPersonInfo.DataSource = personDataSet.Tables["Person"];

                //forces columns in dgvPersonInfo to fill
                for (int i = 0; i < 6; i++)
                {
                    dgvPersonInfo.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                }
                dgvPersonInfo.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet;
                //Debug tool
                //MessageBox.Show("Connection successful.");
            }
            catch
            {
                //duh
                MessageBox.Show("Connection to database failed.");
            }
        }
Exemplo n.º 2
0
 //click new to generate personInformation.cs form with blank fields
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Handlers.OpenPersonInformationForm();
 }
Exemplo n.º 3
0
 //use this to prevent accidental closing of Main form
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     Handlers.CloseCancel();
 }