private void button1_Click(object sender, EventArgs e) { if (textBox1.ReadOnly == false && String.IsNullOrEmpty(textBox1.Text)) { bool jaexiste = false; bool controle = false; if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (controle == false) { if (textBox1.Text == dataGridView1.Rows[i].Cells[1].Value.ToString()) { MessageBox.Show("Já existe este cadastro!"); jaexiste = true; } } } } if (jaexiste == false) { string Stored = "CriarCadModelo"; DALCadastro.AUXCadCriar(Stored, textBox1.Text); dataGridView1.DataSource = DALCadastro.AUXCadListar("ListarCadModelo"); textBox1.ReadOnly = true; textBox1.Text = ""; label3.Text = ""; } } }