fddsantos Posted April 4, 2012 at 01:53 PM Report #447467 Posted April 4, 2012 at 01:53 PM Boa tarde pessoal, Estou com um problema na minha datagrid quando no "SelectionMode" aplico a propriedade "FullRowSelect", quando faço debug só apresenta me a datagrid com as rows sem dados, e tenho a certeza que é por causa desta propriedade porque quando meto a propriedade que estava de inicio ela lista me tudo corretamente. Obrigado pela atenção, Fábio Santos Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 02:05 PM Report #447477 Posted April 4, 2012 at 02:05 PM Como é que a estás a preencher? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 02:05 PM Author Report #447478 Posted April 4, 2012 at 02:05 PM estou a ir buscar os dados à bd e depois listar na datagrid Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 03:14 PM Report #447500 Posted April 4, 2012 at 03:14 PM Mas estás a adicionar linha a linha ou na propriedade DataSource? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 03:19 PM Author Report #447503 Posted April 4, 2012 at 03:19 PM linha a linha com o foreach Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 03:20 PM Report #447505 Posted April 4, 2012 at 03:20 PM E as linhas são adicionadas mas ficam em branco? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 03:22 PM Author Report #447506 Posted April 4, 2012 at 03:22 PM exatamente Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 03:35 PM Report #447512 Posted April 4, 2012 at 03:35 PM Tens a propriedade SelectionBackColor como White? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 03:44 PM Author Report #447514 Posted April 4, 2012 at 03:44 PM Não Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 03:52 PM Report #447516 Posted April 4, 2012 at 03:52 PM Nunca colocaste nenhum DataSource nessa grid antes? As colunas não estão vinculadas por defeito a um campo da Base de Dados? Mostra o teu código. Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 03:56 PM Author Report #447518 Posted April 4, 2012 at 03:56 PM private void InitializedataGridView() { datagrid_Moedas.Columns.Clear(); datagrid_Moedas.Columns.Add("", "ID_Moedas"); datagrid_Moedas.Columns[0].Visible = false; datagrid_Moedas.Columns.Add("", "Nome Facial"); datagrid_Moedas.Columns[1].Width = 200; datagrid_Moedas.Columns.Add("", "Ano"); datagrid_Moedas.Columns.Add("", "ID_Pais"); datagrid_Moedas.Columns[3].Visible = false; datagrid_Moedas.Columns.Add("", "Pais"); datagrid_Moedas.Columns[4].Width = 200; datagrid_Moedas.Columns.Add("", "Valor (Euros)"); datagrid_Moedas.Columns.Add("", "Valor Compra (Euros)"); datagrid_Moedas.Columns.Add("", "Valor Venda (Euros)"); datagrid_Moedas.Columns.Add("", "Lucro Estimado (Euros)"); } private void datagrid_Moedas_SelectionChanged(object sender, EventArgs e) { /* PreencheComboBoxColecao(); PreencheComboBoxEstado(); PreencheComboBoxMetal(); PreencheComboBoxPais(); */ if (validationAux1 == 0) { datagrid_Moedas.Enabled = false; if (datagrid_Moedas.SelectedRows != null && datagrid_Moedas.SelectedRows.Count > 0) { if ((int)datagrid_Moedas.SelectedRows[0].Cells[0].Value == 0) { MessageBox.Show("Não pode seleccionar"); inicioForm(); } else { idSelectMoeda = (int)datagrid_Moedas.SelectedRows[0].Cells[0].Value; procID = idSelectMoeda; List<ClassVarMoeda> lista = new List<ClassVarMoeda>(); lista = gesaplicacao.Gesmoeda.procurar_MoedaID(procID); ClearAll(); foreach (ClassVarMoeda list in lista) { nomeMoeda = list.Nomefacial; /* cbmetal.SelectedIndex = list.Metal - 1; cbestado.SelectedIndex = list.Estado - 1; cbPais.SelectedIndex = list.Pais - 1; cbcoleccao.SelectedIndex = list.Colecao - 1; txtvalor.Text = list.Valor.ToString(); txtLucro.Text = list.LucroEstimado.ToString();*/ //------ //txtValorCompra.Text = list.ValorCompra.ToString(); valorCompra = list.ValorCompra; //txtValorVenda.Text = list.ValorVenda.ToString(); valorVenda = list.ValorVenda; //------ //txtqtd.Text = list.Qtd.ToString(); txtQtdAtual.Text = list.Qtd.ToString(); quantidadeAtual = list.Qtd; /* mtxtano.Text = list.Ano.ToString(); txtdesc.Text = list.Descricao; txtAlbum.Text = list.NomeAlbum; txtPag.Text = list.PaginaAlbum.ToString();*/ if (list.Eixo.CompareTo(EixoAux.Horizontal.ToString()) == 0) { //rbHorizontal.Checked = true; } if (list.Eixo.CompareTo(EixoAux.Vertical.ToString()) == 0) { //rbVertical.Checked = true; } locAux = list.Img; //versoimg.ImageLocation = locAux; locAux1 = list.Img1; //anversoimg.ImageLocation = locAux1; } } btnEditar.Enabled = true; btnsair.Enabled = true; btneditarGravar.Visible = false; btnCancelarEdit.Visible = false; btnSairEdit.Visible = false; } } else { if (datagrid_Moedas.SelectedRows != null && datagrid_Moedas.SelectedRows.Count > 0) { if ((int)datagrid_Moedas.SelectedRows[0].Cells[0].Value == 0) { MessageBox.Show("Não pode seleccionar"); inicioForm(); } else { idSelectMoeda = (int)datagrid_Moedas.SelectedRows[0].Cells[0].Value; procID = idSelectMoeda; List<ClassVarMoeda> lista = new List<ClassVarMoeda>(); lista = gesaplicacao.Gesmoeda.procurar_MoedaID(procID); ClearAll(); foreach (ClassVarMoeda list in lista) { nomeMoeda = list.Nomefacial; /* cbmetal.SelectedIndex = list.Metal - 1; cbestado.SelectedIndex = list.Estado - 1; cbPais.SelectedIndex = list.Pais - 1; cbcoleccao.SelectedIndex = list.Colecao - 1; txtvalor.Text = list.Valor.ToString(); txtLucro.Text = list.LucroEstimado.ToString();*/ //------ //txtValorCompra.Text = list.ValorCompra.ToString(); valorCompra = list.ValorCompra; //txtValorVenda.Text = list.ValorVenda.ToString(); valorVenda = list.ValorVenda; //------ //txtqtd.Text = list.Qtd.ToString(); txtQtdAtual.Text = list.Qtd.ToString(); quantidadeAtual = list.Qtd; /* mtxtano.Text = list.Ano.ToString(); txtdesc.Text = list.Descricao; txtAlbum.Text = list.NomeAlbum; txtPag.Text = list.PaginaAlbum.ToString();*/ if (list.Eixo.CompareTo(EixoAux.Horizontal.ToString()) == 0) { //rbHorizontal.Checked = true; } if (list.Eixo.CompareTo(EixoAux.Vertical.ToString()) == 0) { //rbVertical.Checked = true; } locAux = list.Img; //versoimg.ImageLocation = locAux; locAux1 = list.Img1; //anversoimg.ImageLocation = locAux1; } } btnEditar.Enabled = true; btnsair.Enabled = true; btneditarGravar.Visible = false; btnCancelarEdit.Visible = false; btnSairEdit.Visible = false; } } } Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 04:34 PM Report #447529 Posted April 4, 2012 at 04:34 PM Faz debug para ver o que está a acontecer. Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 05:06 PM Author Report #447536 Posted April 4, 2012 at 05:06 PM ??? eu sei isso porque tenho andado a fazer debug Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 05:42 PM Report #447548 Posted April 4, 2012 at 05:42 PM E então, depois de adicionares uma nova linha ela fica logo em branco? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 05:47 PM Author Report #447552 Posted April 4, 2012 at 05:47 PM querias que eu fizesse debug ou que pusesse um breakdown?? eu ao meter aquela propriedade do "FullSelectRow" quando faço debug veijo que ele no list passa me o foreach, ou seja, não me chega a entrar no foreach para listar os dados Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 05:50 PM Report #447553 Posted April 4, 2012 at 05:50 PM Estas a dizer que ele chega a uma determinada linha e salta fora? Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 05:52 PM Author Report #447555 Posted April 4, 2012 at 05:52 PM exato Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 05:53 PM Report #447558 Posted April 4, 2012 at 05:53 PM Estas a usar x64, certo? Coloca tratamento de erro nesse código e vê se ele te dá uma excepção. Pedro Martins Não respondo a duvidas por PM
fddsantos Posted April 4, 2012 at 05:57 PM Author Report #447560 Posted April 4, 2012 at 05:57 PM o meu pc é x64 mas estou a fazer debug de x86 Lei de Lavoisier aplicada à Informática:Na Informática nada se compra, nada se cria! Tudo se copia!
Caça Posted April 4, 2012 at 07:42 PM Report #447589 Posted April 4, 2012 at 07:42 PM Ok, já experimentaste fazer o tratamento de erro(Try Catch Finally) a esse código? É que algumas máquinas x64 tem ai um pequeno problema.. Pedro Martins Não respondo a duvidas por PM
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