private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.ReadOnly == false && String.IsNullOrEmpty(textBox1.Text) == false &&
                String.IsNullOrEmpty(textBox2.Text) == false && textBox2.ReadOnly == false)
            {
                Int64 qtde;
                if (Int64.TryParse(textBox2.Text.Trim(), out qtde) == false)
                {
                    MessageBox.Show("Favor informar somente valores numéricos no campo \ncódigo NCM.");
                    textBox2.Text = "";
                    textBox2.Focus();
                    return;
                }
                DataTable ncm = DALCadastro.AUXCadListar("ListarCadGenero");
                if (ncm.Rows.Count > 0)
                {
                    for (int i = 0; i < ncm.Rows.Count; i++)
                    {
                        if (textBox2.Text == ncm.Rows[i]["Codigo"].ToString())
                        {
                            MessageBox.Show("Código já cadastrado anteriormente.");
                            return;
                        }
                    }
                    string            message = "Você deseja cadastrar este Código de Gênero : \n" + textBox2.Text + " ?";
                    string            caption = "Gênero";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(this, message, caption, buttons,
                                             MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (result == DialogResult.Yes)
                    {
                        DALCadastro.CriarCadGenero(textBox2.Text, textBox1.Text);
                        dataGridView1.DataSource = DALCadastro.AUXCadListar("ListarCadGenero");
                        MessageBox.Show("Código : " + textBox2.Text + "\n" + textBox1.Text + "\nincluído com sucesso.");
                        string cod = textBox2.Text;
                        textBox1.ReadOnly = true;
                        textBox1.Text     = "";
                        textBox2.ReadOnly = true;
                        textBox2.Text     = "";
                        if (dataGridView1.Rows.Count > 0)
                        {
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)
                            {
                                if (dataGridView1.Rows[i].Cells[0].Value.ToString() == cod)
                                {
                                    dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0];
                                    textBox2.Text             = dataGridView1.Rows[i].Cells[0].Value.ToString();
                                    textBox1.Text             = dataGridView1.Rows[i].Cells[1].Value.ToString();
                                    button4.Focus();
                                    return;
                                }
                            }
                        }
                    }
                }
                if (ncm.Rows.Count <= 0)
                {
                    string            message = "Você deseja cadastrar este Código de Gênero : \n" + textBox2.Text + " ?";
                    string            caption = "Gênero";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(this, message, caption, buttons,
                                             MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (result == DialogResult.Yes)
                    {
                        DALCadastro.CriarCadGenero(textBox2.Text, textBox1.Text);
                        dataGridView1.DataSource = DALCadastro.AUXCadListar("ListarCadGenero");
                        MessageBox.Show("Código : " + textBox2.Text + "\n" + textBox1.Text + "\nincluído com sucesso.");
                        textBox1.ReadOnly = true;
                        textBox1.Text     = "";
                        textBox2.ReadOnly = true;
                        textBox2.Text     = "";
                    }
                }
            }
        }