示例#1
0
 void table_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (table.ColumnCount == 7)
     {
         if (e.ColumnIndex == table.Columns[5].Index)
         {
             int  ind   = e.RowIndex;
             Ship ship  = (Ship)table.Rows[e.RowIndex].Tag;
             edit form2 = new edit(ship, this, ind);
             form2.Show();
         }
         else if (e.ColumnIndex == table.Columns[6].Index)
         {
             if (this.table.SelectedRows.Count > 0 &&
                 this.table.SelectedRows[0].Index !=
                 this.table.Rows.Count - 1)
             {
                 this.table.Rows.RemoveAt(
                     this.table.SelectedRows[0].Index);
             }
         }
         else
         {
             return;
         }
     }
     else
     {
         return;
     }
 }
示例#2
0
 private void addNewRowButton_Click(object sender, EventArgs e)
 {
     try
     {
         edit form2 = new edit(this);
         form2.Show();
     }
     catch (Exception c)
     {
         MessageBox.Show(c.ToString());
     }
 }