using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using DAL; using BLL; using System.Data.SqlClient; namespace IBRCAD { public partial class frm_consultacategoria : Form { public int codigo = 0; public frm_consultacategoria() { InitializeComponent(); } private void Frm_consultacategoria_Load(object sender, EventArgs e) { Btn_localizar_Click(sender, e); dgv_dados.Columns[0].HeaderText = "Código"; dgv_dados.Columns[0].Width = 50; dgv_dados.Columns[1].HeaderText = "Categoria"; dgv_dados.Columns[1].Width = 700; } private void Btn_localizar_Click(object sender, EventArgs e) { DALLconexao cx = new DALLconexao(DadosDaConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); dgv_dados.DataSource = bll.Localizar(txt_pesquisa.Text); } private void Dgv_dados_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { this.codigo = Convert.ToInt32(dgv_dados.Rows[e.RowIndex].Cells[0].Value); this.Close(); } } } }