private void frmCadastroProduto_Load(object sender, EventArgs e) { ClassPlataforma cPlat = new ClassPlataforma(); CbPlat.DataSource = cPlat.SearchPlat(); CbPlat.DisplayMember = "Plataforma"; CbPlat.ValueMember = "CodPlat"; CbPlat.SelectedValue = UpdatePlat; ClassCategoria CCat = new ClassCategoria(); CbCat.DataSource = CCat.CbCat(); CbCat.DisplayMember = "Nome"; CbCat.ValueMember = "CodCategoria"; CbCat.SelectedValue = UpdateCat; }
private void cbTipo_SelectedIndexChanged(object sender, EventArgs e) { gbStatus.Enabled = false; gbVal.Enabled = false; txtPes.Enabled = false; txtVfi.Enabled = false; txtVin.Enabled = false; cbCat.Enabled = false; cbPlat.Enabled = false; if (cbTipo.SelectedIndex == 0) { gbStatus.Enabled = true; } if (cbTipo.SelectedIndex == 1) { txtPes.Enabled = true; } if (cbTipo.SelectedIndex == 2) { gbVal.Enabled = true; } txtVfi.Enabled = true; txtVin.Enabled = true; if (cbTipo.SelectedIndex == 3) { cbPlat.Enabled = true; ClassPlataforma cPlat = new ClassPlataforma(); cbPlat.DataSource = cPlat.SearchPlat(); cbPlat.DisplayMember = "Plataforma"; cbPlat.ValueMember = "CodPlat"; cbPlat.SelectedIndex = -1; } if (cbTipo.SelectedIndex == 4) { cbCat.Enabled = true; ClassCategoria cc = new ClassCategoria(); cbCat.DataSource = cc.CbCat(); cbCat.DisplayMember = "Nome"; cbCat.ValueMember = "CodCategoria"; cbCat.SelectedIndex = -1; } if (cbTipo.SelectedIndex == 5) { txtPes.Enabled = true; } }