Ejemplo n.º 1
0
        // Edit
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvComponentsList.SelectedRows.Count != 1)
            {
                return;
            }

            EditForms.AddComponentForm childForm = new EditForms.AddComponentForm();

            // Fill data
            childForm.txbID.Text   = dgvComponentsList.SelectedRows[0].Cells["comID"].Value.ToString();
            childForm.txbName.Text = dgvComponentsList.SelectedRows[0].Cells["comName"].Value.ToString();

            childForm.cmbTypes.SelectedValue = dgvComponentsList.SelectedRows[0].Cells["comTypeID"].Value;
            childForm.cmbTypes.Enabled       = false;

            for (int i = 0; i < 10; i++)
            {
                ((TextBox)childForm.textBoxes[i]).Text
                    = dgvComponentsList.SelectedRows[0].Cells["comParamInt" + (i + 1).ToString()].Value.ToString();
            }

            for (int i = 0; i < 10; i++)
            {
                ((TextBox)childForm.textBoxes[i + 10]).Text
                    = dgvComponentsList.SelectedRows[0].Cells["comParamString" + (i + 1).ToString()].Value.ToString();
            }


            childForm.Owner = this;
            childForm.ShowDialog();
        }
Ejemplo n.º 2
0
        //
        // BUTTONS
        //

        // Add new
        private void button2_Click(object sender, EventArgs e)
        {
            EditForms.AddComponentForm childForm = new EditForms.AddComponentForm();

            childForm.Owner = this;
            childForm.ShowDialog();
        }