csantos Posted May 21, 2013 at 02:18 PM Report #508219 Posted May 21, 2013 at 02:18 PM boa tarde na minha form tenho uma datagrid e eu queria importar dados da minha base de dados (ex:cod_produto), e quero quando eu escolher um codigo de produto que me preenche automaticamente o campo Nome. eu já criei os campos da datagrid através de código: DataGridView1.Columns.Add("Cod_Prod", "Cod_Prod") DataGridView1.Columns.Add("Nome", "Nome") DataGridView1.Columns.Add("Fornecedor", "Fornecedor") DataGridView1.Columns.Add("Origem", "Origem") DataGridView1.Columns.Add("Lote", "Lote") DataGridView1.Columns.Add("Arm_Origem", "Arm_Origem") DataGridView1.Columns.Add("ID_Linha", "ID_Linha") DataGridView1.Columns.Add("Quant_Kg", "Quant_Kg") Dim dataGridRow As New DataGridViewRow() Dim Cod_Prod_cmb As New DataGridViewComboBoxCell() Dim Nome_txt As New DataGridViewTextBoxCell() Dim Fornecedor_txt As New DataGridViewTextBoxCell() Dim Origem_txt As New DataGridViewTextBoxCell() Dim Lote_txt As New DataGridViewTextBoxCell() Dim Origem_txt_txt As New DataGridViewTextBoxCell() Dim Quant_Kg_txt As New DataGridViewTextBoxCell() Dim Linha_txt As New DataGridViewTextBoxCell() dataGridRow.Cells.Add(Cod_Prod_cmb) DataGridView1.Rows.Add(dataGridRow) Agradeço a ajuda...
fantasticleague Posted May 21, 2013 at 02:23 PM Report #508221 Posted May 21, 2013 at 02:23 PM (edited) no teu caso é, metes isso no evento do datagridview With nomedoform .Show() .JogadoresBindingSource.Position = .JogadoresBindingSource.Find("Nome", JogadoresDataGridView.CurrentRow.Cells(0).Value) End With exprimenta e depois dizes-me, mas arrasta tambem as textboxs do server explorer da tabela que queres, depois deixas estar as que quiseres usar cumps PS: não precisas de nada do que ai tens, penso, mete isso td como comentario e exprimenta o meu Edited May 21, 2013 at 02:24 PM by fantasticleague
csantos Posted May 21, 2013 at 03:15 PM Author Report #508230 Posted May 21, 2013 at 03:15 PM no teu caso é, metes isso no evento do datagridview With nomedoform .Show() .JogadoresBindingSource.Position = .JogadoresBindingSource.Find("Nome", JogadoresDataGridView.CurrentRow.Cells(0).Value) End With exprimenta e depois dizes-me, mas arrasta tambem as textboxs do server explorer da tabela que queres, depois deixas estar as que quiseres usar cumps PS: não precisas de nada do que ai tens, penso, mete isso td como comentario e exprimenta o meu desculpa mas não percibi muito bem a tua ideia...
fantasticleague Posted May 21, 2013 at 04:09 PM Report #508244 Posted May 21, 2013 at 04:09 PM explicame bem o que queres fazer..
csantos Posted May 21, 2013 at 04:37 PM Author Report #508250 Posted May 21, 2013 at 04:37 PM explicame bem o que queres fazer.. Eu quero ter duas comboboxs na minha datagrid (Codigo e Nome), e ao escolher o Código ou o Nome quero que me preenche automaticamente os outros campos na mesma linha com informações relacionadas com o Código ou Nome.
bioshock Posted May 22, 2013 at 08:39 AM Report #508305 Posted May 22, 2013 at 08:39 AM Tens várias formas de fazer o que pretendes. https://wiki.portugal-a-programar.pt/dev_net/vb.net/poptextbox/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now