Hi to you all. I´m a begginner with Basic4PP, I started a few days ago and I decided to make a program to help with my work, on annual stock control. With a great help of some of you, i make the code i attach. That code works well on desktop, i just only need to make some improvments but is ready to help me out. However when i compile and test on the device i got the error: NullReferenceException on that prodedures:
1. one sub that change table columns width:
Sub tamanhocolunas()
table1.ColWidth("artigo") = 75
table1.ColWidth("ubic") = 25
table1.ColWidth("act") = 20
table1.ColWidth("conta") = 30
table1.ColWidth("descricao") = 85
table1.ColWidth("fam") = 25
table1.ColWidth("subf") = 25
table1.ColWidth("IDPK") = 30
End Sub
2. one sub developed by Erel on is editable procedure that i changed to fill my needs
' TRYING TO UPDATE DATABASE
'This sub will be called before setting any value in table1.
'The value will only be set if Validate returns true.
Sub Validate(column, value,row)
chave=Table1.Cell("IDPK",row)
If column <> "conta" AND Not(IsNumber(value)) Then
Msgbox("ERROR: Solamente puede editar la columna [conta] e tiene de poner valor numerico.")
Return False
Else
cmd.CommandText = "UPDATE inventario SET conta = "& value & " WHERE IDPK = "& chave
cmd.ExecuteNonQuery
Return True
End If
End Sub
I attached complete code with a compact database due to size attach limitations. I hope that someone could help me to put that working.
Thanks a lot. Regards.
1. one sub that change table columns width:
Sub tamanhocolunas()
table1.ColWidth("artigo") = 75
table1.ColWidth("ubic") = 25
table1.ColWidth("act") = 20
table1.ColWidth("conta") = 30
table1.ColWidth("descricao") = 85
table1.ColWidth("fam") = 25
table1.ColWidth("subf") = 25
table1.ColWidth("IDPK") = 30
End Sub
2. one sub developed by Erel on is editable procedure that i changed to fill my needs
' TRYING TO UPDATE DATABASE
'This sub will be called before setting any value in table1.
'The value will only be set if Validate returns true.
Sub Validate(column, value,row)
chave=Table1.Cell("IDPK",row)
If column <> "conta" AND Not(IsNumber(value)) Then
Msgbox("ERROR: Solamente puede editar la columna [conta] e tiene de poner valor numerico.")
Return False
Else
cmd.CommandText = "UPDATE inventario SET conta = "& value & " WHERE IDPK = "& chave
cmd.ExecuteNonQuery
Return True
End If
End Sub
I attached complete code with a compact database due to size attach limitations. I hope that someone could help me to put that working.
Thanks a lot. Regards.