示例#1
0
        private void b_newF_Click(object sender, EventArgs e)
        {
            dTGVF.AllowUserToAddRows = true;
            dTGVF.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            int          sor  = dTGVF.Rows.Count - 1;
            Gun          ng   = new Gun();
            FormNewEditF fnef = new FormNewEditF(ng);

            if (fnef.ShowDialog(this) == DialogResult.OK)
            {
                Gun editedGun = fnef.editedGun();

                // dTGVF.Rows[sor].Cells["FID"].Value = editedGun.getId();
                dTGVF.Rows[sor].Cells["gyarto"].Value  = editedGun.getGyarto();
                dTGVF.Rows[sor].Cells["nev"].Value     = editedGun.getNev();
                dTGVF.Rows[sor].Cells["tipus"].Value   = editedGun.getTipus();
                dTGVF.Rows[sor].Cells["FPS"].Value     = editedGun.getFPS();
                dTGVF.Rows[sor].Cells["suly"].Value    = editedGun.getSuly();
                dTGVF.Rows[sor].Cells["anyag"].Value   = editedGun.getAnyag();
                dTGVF.Rows[sor].Cells["ar"].Value      = editedGun.getAr();
                dTGVF.Rows[sor].Cells["varians"].Value = editedGun.getVarians();
                for (int i = 0; i < sor; i++)
                {
                    dTGVF.Rows[i].ReadOnly = false;
                    dTGVF.FirstDisplayedScrollingRowIndex = sor;
                }
            }

            dTGVF.Columns[0].ReadOnly = true;
        }
示例#2
0
        private void b_editF_Click(object sender, EventArgs e)
        {
            int fid = Convert.ToInt32(dTGVF.SelectedRows[0].Cells["FID"].Value);

            Gun g = new Gun(
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["FID"].Value),
                dTGVF.SelectedRows[0].Cells["gyarto"].Value.ToString(),
                dTGVF.SelectedRows[0].Cells["nev"].Value.ToString(),
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["tipus"].Value),
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["FPS"].Value),
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["suly"].Value),
                dTGVF.SelectedRows[0].Cells["anyag"].Value.ToString(),
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["ar"].Value),
                Convert.ToInt32(dTGVF.SelectedRows[0].Cells["varians"].Value)
                );

            FormNewEditF fnef = new FormNewEditF(g);

            if (fnef.ShowDialog(this) == DialogResult.OK)
            {
                Gun editedGun = fnef.editedGun();
                int sor       = dTGVF.SelectedRows[0].Index;
                // dTGVF.Rows[sor].Cells["FID"].Value = editedGun.getId();
                dTGVF.Rows[sor].Cells["gyarto"].Value  = editedGun.getGyarto();
                dTGVF.Rows[sor].Cells["nev"].Value     = editedGun.getNev();
                dTGVF.Rows[sor].Cells["tipus"].Value   = editedGun.getTipus();
                dTGVF.Rows[sor].Cells["FPS"].Value     = editedGun.getFPS();
                dTGVF.Rows[sor].Cells["suly"].Value    = editedGun.getSuly();
                dTGVF.Rows[sor].Cells["anyag"].Value   = editedGun.getAnyag();
                dTGVF.Rows[sor].Cells["ar"].Value      = editedGun.getAr();
                dTGVF.Rows[sor].Cells["varians"].Value = editedGun.getVarians();
            }
        }