fddsantos Posted March 30, 2012 at 11:05 AM Report #446562 Posted March 30, 2012 at 11:05 AM Boa tarde, Estou com um problema no meu programa que é quando tenho a minha datagrid dentro da groupbox ela apresenta dados, quando tiro a datagrid fora da groupbox ela deixa de apresentar dados, apresenta só as linhas correspondentes aos dados. Gostava de saber se há alguma solução para este problema, ou seija, se consigo ter a datagrid fora da groupbox e apresentar dados à mesma. Obrigada pela atenção, Fábio Santos Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Gonka Posted March 30, 2012 at 11:27 AM Report #446567 Posted March 30, 2012 at 11:27 AM Como é que estás a preencher a DataGrid?
fddsantos Posted March 30, 2012 at 11:42 AM Author Report #446572 Posted March 30, 2012 at 11:42 AM private void listRegistos() { List<ClassVarMoeda> lista1 = new List<ClassVarMoeda>(); lista1 = gesaplicacao.Gesmoeda.listarMoeda1(); int row = 0; if (validationAux1 == 0) { if (lista1.Count < 1) { MessageBox.Show("Não existem moedas registadas.", "Atenção!"); txtProcNome.Enabled = false; txtProcPais.Enabled = false; datagrid_Moedas.Enabled = false; } else { datagrid_Moedas.Enabled = false; datagrid_Moedas.RowCount = lista1.Count; foreach (ClassVarMoeda listM in lista1) { datagrid_Moedas.Rows[row].Cells[0].Value = listM.Idmoeda; datagrid_Moedas.Rows[row].Cells[1].Value = listM.Nomefacial; datagrid_Moedas.Rows[row].Cells[2].Value = listM.Ano; datagrid_Moedas.Rows[row].Cells[3].Value = listM.Pais; datagrid_Moedas.Rows[row].Cells[4].Value = listM.NomePais; datagrid_Moedas.Rows[row].Cells[5].Value = listM.Valor; datagrid_Moedas.Rows[row].Cells[6].Value = listM.ValorCompra; datagrid_Moedas.Rows[row].Cells[7].Value = listM.ValorVenda; datagrid_Moedas.Rows[row].Cells[8].Value = listM.LucroEstimado; row++; } } } else { if (auxIni == 1) { if (lista1.Count < 1) { MessageBox.Show("Não existem moedas registadas.", "Atenção!"); txtProcNome.Enabled = false; txtProcPais.Enabled = false; datagrid_Moedas.Enabled = false; row++; } else { datagrid_Moedas.Enabled = true; datagrid_Moedas.RowCount = lista1.Count; foreach (ClassVarMoeda listM in lista1) { datagrid_Moedas.Rows[row].Cells[0].Value = listM.Idmoeda; datagrid_Moedas.Rows[row].Cells[1].Value = listM.Nomefacial; datagrid_Moedas.Rows[row].Cells[2].Value = listM.Ano; datagrid_Moedas.Rows[row].Cells[3].Value = listM.Pais; datagrid_Moedas.Rows[row].Cells[4].Value = listM.NomePais; datagrid_Moedas.Rows[row].Cells[5].Value = listM.Valor; datagrid_Moedas.Rows[row].Cells[6].Value = listM.ValorCompra; datagrid_Moedas.Rows[row].Cells[7].Value = listM.ValorVenda; datagrid_Moedas.Rows[row].Cells[8].Value = listM.LucroEstimado; row++; } auxIni = 2; } } else { if (lista1.Count < 1) { MessageBox.Show("Não existem moedas registadas.", "Atenção!"); txtProcNome.Enabled = false; txtProcPais.Enabled = false; datagrid_Moedas.Enabled = false; row++; } else { datagrid_Moedas.Enabled = true; datagrid_Moedas.RowCount = lista1.Count; foreach (ClassVarMoeda listM in lista1) { datagrid_Moedas.Rows[row].Cells[0].Value = listM.Idmoeda; datagrid_Moedas.Rows[row].Cells[1].Value = listM.Nomefacial; datagrid_Moedas.Rows[row].Cells[2].Value = listM.Ano; datagrid_Moedas.Rows[row].Cells[3].Value = listM.Pais; datagrid_Moedas.Rows[row].Cells[4].Value = listM.NomePais; datagrid_Moedas.Rows[row].Cells[5].Value = listM.Valor; datagrid_Moedas.Rows[row].Cells[6].Value = listM.ValorCompra; datagrid_Moedas.Rows[row].Cells[7].Value = listM.ValorVenda; datagrid_Moedas.Rows[row].Cells[8].Value = listM.LucroEstimado; row++; } } } } } Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
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