示例#1
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         DataGridViewRow row              = this.dataGridView1.Rows[e.RowIndex];
         string          idGasto          = row.Cells["ID"].Value.ToString();
         Formularios.Form_GastosFijos frm = new Formularios.Form_GastosFijos(idGasto);
         frm.lista_Gastos += new Form1.MessageHandler(lista_Gastos);
         frm.ShowDialog();
     }
 }
示例#2
0
        private void toolStripButton_Edit_Click(object sender, EventArgs e)
        {
            //Valida que no haya mas de un registro seleccionado
            int contador = 0;

            //Finaliza modo de edicion
            dataGridView1.EndEdit();
            foreach (DataGridViewRow registro in dataGridView1.Rows)
            {
                try
                {
                    if ((Boolean)registro.Cells["Seleccionar"].Value == true)
                    {
                        contador++;
                    }
                }
                catch { }
            }

            if (contador == 0)
            {
                MessageBox.Show("Debe seleccionar al menos un registro.");
                return;
            }

            if (contador > 1)
            {
                MessageBox.Show("Para editar solo seleccione un registro.");
                return;
            }
            else
            {
                foreach (DataGridViewRow registro in dataGridView1.Rows)
                {
                    try
                    {
                        if ((Boolean)registro.Cells["Seleccionar"].Value == true)
                        {
                            string idGasto = registro.Cells["ID"].Value.ToString();
                            Formularios.Form_GastosFijos frm = new Formularios.Form_GastosFijos(idGasto);
                            frm.lista_Gastos += new Form1.MessageHandler(lista_Gastos);
                            frm.ShowDialog();
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
示例#3
0
 private void toolStripButton_Add_Click(object sender, EventArgs e)
 {
     Formularios.Form_GastosFijos frm = new Formularios.Form_GastosFijos("");
     frm.lista_Gastos += new Form1.MessageHandler(lista_Gastos);
     frm.ShowDialog();
 }