VBA migration to C # cycle for- V10 (ValidaLinha)

1

In event ValidaLinha in VBA would look something like this:

Me.DocumentoVenda.Linhas(i).CamposUtil("CDU_LinVar1").Valor > 0

In C # I'm doing:

this.DocumentoVenda.Linhas(i).CamposUtil["CDU_LinVar1"].Valor > 0

But something else should be missing. Can you give me a sff tip?

public override void ValidaLinha(int NumLinha, ExtensibilityEventArgs e)
{
    int i;
    for (   i = 1; i <= this.DocumentoVenda.Linhas.NumItens; i++)
    {
        if (this.DocumentoVenda.Linhas(i).CamposUtil["CDU_LinVar1"].Valor > 0)
        {               
        this.DocumentoVenda.Linhas(i).Quantidade = this.DocumentoVenda.Linhas(i).CamposUtil["CDU_LinVar1"].Valor * this.DocumentoVenda.Linhas(i).QuantFormula;
        }
    }

    base.ValidaLinha(NumLinha, e);
}
    
asked by anonymous 05.07.2018 / 10:06

1 answer

0

The most correct will be:

if(PSO.Utils.FInt(this.DocumentoVenda.Linhas.GetEdita(i).CamposUtil["CDU_LinVar1"].Valor) > 0)
    // código aqui...

Use FInt to convert the value (which is dynamic ) to integer and then make the comparison.

    
05.07.2018 / 10:32