table addRow problem

Discussion in 'Questions (Windows Mobile)' started by Luiji, May 16, 2008.

  1. Luiji

    Luiji Member Licensed User

    please help
    I have a table whith 4 colums, the first is sting the other numbers
    Code:

    Sub Button4_Click
    Form1.Show
    table1.AddCol(cString,"Item",85)
    table1.AddCol(cNumber,"Quant.",40)
    table1.AddCol(cNumber,"P.Unit.",50)
    table1.AddCol(cNumber,"P.Parc.",50)
    End Sub

    Sub btnGravar_Click
    Nome=tbNome.text ' item
    Quantidade=tbQuantidade.Text 'Quant.
    PrecoUnidade=tbPrecoUnidade.Text 'P.Unit.
    precoParcial=tbQuantidade.Text*tbPrecoUnidade.Text 'P.Parc.
    table1.AddRow(Nome,Quantidade,PrecoUnidade,precoParcial)
    End Sub

    it works fine on Run mode in IDE, but dont work compiled to Pc or to PPC
    error:
    An error ocurred on sub_btngravar_click
    Input string was not in correct format
     
  2. Rallig

    Rallig Member Licensed User

    Perhaps it is not the solution of this problem but I see a space in:

    table1.AddRow(Nome,Quantidade,PrecoUnidade,precoPa rcial)


    Greeting
    Rallig
     
  3. agraham

    agraham Expert Licensed User

    I can't see anything wrong with the code (apart from the extra space) but that error is what you will get if any of the textboxes that are to be assigned to numeric table columns contain values that do not represent a valid number.
     
  4. Luiji

    Luiji Member Licensed User

    hi!!
    the space is a copy paste error :)

    correction:
    Sub Button4_Click
    Form1.Show
    table1.AddCol(cString,"Item",85)
    table1.AddCol(cNumber,"Quant.",40)
    table1.AddCol(cNumber,"P.Unit.",50)
    table1.AddCol(cNumber,"P.Parc.",50)
    End Sub

    Sub btnGravar_Click
    Nome=tbNome.text ' item
    Quantidade=tbQuantidade.Text 'Quant.
    PrecoUnidade=tbPrecoUnidade.Text 'P.Unit.
    precoParcial=tbQuantidade.Text*tbPrecoUnidade.Text 'P.Parc.
    table1.AddRow(Nome,Quantidade,PrecoUnidade,precoParcial)
    End Sub
     
  5. Luiji

    Luiji Member Licensed User

    :(((
    i corected the text, but the space apears again
    ???

    table1.AddRow(Nome,Quantidade,PrecoUnidade,precoParcial)
     
  6. Luiji

    Luiji Member Licensed User

    space again

    ?????

    table1.AddRow(Nome,Quantidade,PrecoUnidade,precoParcial)



    i insert in the text box data in correct format
     
  7. Luiji

    Luiji Member Licensed User

    in IDE there is no space in "precoParcial"
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload your source code file?
     
  9. Luiji

    Luiji Member Licensed User

    Hi Erel...

    the code file you requested
     
  10. agraham

    agraham Expert Licensed User

    The problem is with "lblTotal.Text". It is blank by default which the optimising compiler cannot convert to a number and so errors. Set the text to "0" and it works.

    You didn't show this line in your code snippet "precototal=lblTotal.Text+precoParcial" :confused:
     
  11. Luiji

    Luiji Member Licensed User

    Thank
    i changed label to textbox, and it work fine.
     
  12. agraham

    agraham Expert Licensed User

    You didn't need to change it from a label, you just needed to make sure, as you will also need to do for a textbox, that the label.text contents could be converted to a valid number.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice