コード例 #1
0
        private void dgvVegetal_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var codigo = Convert.ToInt32(dgvVegetal.Rows[e.RowIndex].Cells["Codigo"].Value.ToString());

                try
                {
                    var vegetal = _logica.Encontrar(codigo);

                    if (vegetal == null)
                    {
                        MessageBox.Show("Nenhum vegetal foi encontrado!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        var form = new CadastroVegetais(FormularioMenu, vegetal);

                        form.Show();

                        Hide();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        private void vegetaisToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var cadVeg = new CadastroVegetais(this);

            cadVeg.Show();
        }