Esempio n. 1
0
 private void EditTrip_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows.Count > 0)
     {
         var  sua = dataGridView1.SelectedRows[0].DataBoundItem;
         Form pf  = new ThemChuyem();
     }
     else
     {
         MessageBox.Show("Sorry,there is nothing to edit.By the way, add some potions or delete the agency..");
     }
 }
Esempio n. 2
0
        private void AddTrip_Click(object sender, EventArgs e)
        {
            Form frm = new ThemChuyem();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                // select and scroll to the last row
                if (dataGridView1.Rows.Count > 1)
                {
                    var lastIdx = dataGridView1.Rows.Count - 1;
                    dataGridView1.Rows[lastIdx].Selected          = true;
                    dataGridView1.FirstDisplayedScrollingRowIndex = lastIdx;
                }
            }
        }