none
procurar parcela na datagrid e mudar valor das celulas RRS feed

  • Pergunta

  • ola pessoal, tenho um DataGridView com 3 colunas: PARCELA, VENCIMENTO, VALOR, se o usuario informar parcela 3 por exemplo, Vencimento 18/10/2013 , valor 500,00 tem que ir na celula referente a parcela 3 e mudar o Vencimento e o Valor, como se faz isso ? Quero mudar o Vencimento e o Valor referente a parcela informada, esta DataGrid nao esta usando tabela.

    Visual Studio 2010, windowsform,

    obrigado.

    quinta-feira, 17 de outubro de 2013 17:08

Respostas

  • Preenchimento ...

    Grid.Rows.Add(3);
    
    Grid.Rows[0].Cells[0].Value = "1";
    Grid.Rows[0].Cells[1].Value = "10/10/2010";
    Grid.Rows[0].Cells[2].Value = "250.00";
    
    Grid.Rows[1].Cells[0].Value = "2";
    Grid.Rows[1].Cells[1].Value = "12/10/2010";
    Grid.Rows[1].Cells[2].Value = "1250.10";
    
    Grid.Rows[2].Cells[0].Value = "3";
    Grid.Rows[2].Cells[1].Value = "14/1/2010";
    Grid.Rows[2].Cells[2].Value = "250.10";

    Busca no número 3:

    Boolean Loop = true;
    int i = 0;
    while (Loop && i < Grid.Rows.Count)
    {
    	DataGridViewRow Row = Grid.Rows[i];
    	if (Row.Cells[0].Value.Equals("3"))
    	{
    		Row.Cells[1].Value = "13/13/2012";
    		Row.Cells[2].Value = 1000000;
    		Loop = false;
    	}
    	i++;
    }


    Fúlvio Cezar Canducci Dias

    sexta-feira, 18 de outubro de 2013 01:10