Ive created a new label in a document called 'worthATry'. This label stores an integer. when i try calling this property into a variable in c# i get "Object reference not set to an instance of an object" error, but when i try a different property like a tickbox (returning 1 or 0) it works perfectly. is there a reason i cannot convert a textsring or label to an int?
int INT3 = Convert.ToInt32(n.GetProperty("worthATry").Value); // doesnt work
int INT3 = Convert.ToInt32(n.GetProperty("tickbox ").Value); //does work
i have definitely used the correct alias for the property.
Converting label or textstring to int
Ive created a new label in a document called 'worthATry'. This label stores an integer. when i try calling this property into a variable in c# i get "Object reference not set to an instance of an object" error, but when i try a different property like a tickbox (returning 1 or 0) it works perfectly. is there a reason i cannot convert a textsring or label to an int?
int INT3 = Convert.ToInt32(n.GetProperty("worthATry").Value); // doesnt work
int INT3 = Convert.ToInt32(n.GetProperty("tickbox ").Value); //does work
i have definitely used the correct alias for the property.
The error comes from the getProperty call, the property obviously can't be found so you can't get the .Value either.
Check the casing of the "worthATry" property on the document type with the alias in your code.
I dont know why this was happening. after i try getting the value in an onboundevent and setting a label with the value it worked.
is working on a reply...