-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmConsultaCategoria.cs
61 lines (48 loc) · 1.48 KB
/
frmConsultaCategoria.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
namespace GUI
{
public partial class frmConsultaCategoria : Form
{
public int codigo = 0;
public frmConsultaCategoria()
{
InitializeComponent();
}
private void btnPesquizar_Click(object sender, EventArgs e)
{
DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
BLLCategoria bll = new BLLCategoria(cx);
dgvDados.DataSource = bll.Localizar(txtValor.Text);
}
private void frmConsultaCategoria_Load(object sender, EventArgs e)
{
btnPesquizar_Click(sender, e);
dgvDados.Columns[0].HeaderText = "Código";
dgvDados.Columns[0].Width = 55;
dgvDados.Columns[1].HeaderText = "Categoria";
dgvDados.Columns[1].Width = 480;
}
private void dgvDados_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
//verifica se a linha é maior que zero
if (e.RowIndex >= 0)
{
this.codigo = Convert.ToInt32(dgvDados.Rows[e.RowIndex].Cells[0].Value);
this.Close();
}
}
private void txtValor_TextChanged(object sender, EventArgs e)
{
}
}
}