|
Hi Brendan, I would use the following method to "reset" a vaiable: UnDim MyVariable Dim MyVariable MapBasic doesn't support a "nothing" or "null" value with variables, so only undeclared variables can be considered "null'ed". Unfortunately, MapBasic doesn't provide a function like IsDim ( MyVariable ), so it's an unstable and troublesome method to use, as you've discovered yourself. The best way imho seems to be to statically define valid but unrealistic values to be your "null" value, and test for them. E.g.: Define NULL_STRING "*!*!* highly unlikely value *!*!*" Define NULL_INTEGER -123456789 Dim s as String Dim i as Integer s = NULL_STRING 'set to NULL i = NULL_INTEGER 'sety to NULL If s = NULL_STRING or i = NULL_INTEGER Then Note "One or both variables are NULL" End If HTH Best regards / Med venlig hilsen Lars I. Nielsen GisPro Brendan Tagg wrote: I am writing some code and have come to the situation where I need to assign a 'nothing' , or null or empty to a already existing (& populated) object variable.For example: Procedure A determines (conditionally) weather or not to assign an object variable (eg does a create object buffer into variable xyz width 0). Procedure B needs to overwrite the same object variable but sometimes the new object value is nothing (no object) . So how do I set the object back to an empty state so that str$(ObjectVariable)="" I have tried the following: Dim z as Object xyz = z 'where xyz is my original object But I get the message "Cannot use an uninitialized object variable in an _expression_" Is there an easy way to do this ? Thanks in advance. Brendan Tagg Strategy and Property Analysis | Database and Information Analyst Coles Myer Ltd. Tel: (03) 982 94269 Fax: (03) 982 93227 Mail: PO Box 2000, Glen Iris, Victoria 3146 Email: [EMAIL PROTECTED]This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l |
_______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
