davepamn Active Member Licensed User Longtime User Aug 18, 2014 #1 I am getting an error that an variable has not been initialized. Is there a why to know what variables must have an initialize call var.initialize
I am getting an error that an variable has not been initialized. Is there a why to know what variables must have an initialize call var.initialize
S sorex Expert Licensed User Longtime User Aug 18, 2014 #2 I think you mean views? variables should only be DIMmed Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 18, 2014 #3 Any variable that has an Initialize method should be initialized. Views added with the designer are initialized when you load the layout so you shouldn't call Initialize again. Upvote 0
Any variable that has an Initialize method should be initialized. Views added with the designer are initialized when you load the layout so you shouldn't call Initialize again.
davepamn Active Member Licensed User Longtime User Aug 18, 2014 #4 Is there an easy way to find the variable that had an initialize method but was not invoked. Upvote 0
S strat Active Member Licensed User Longtime User Aug 18, 2014 #5 davepamn said: Is there an easy way to find the variable that had an initialize method but was not invoked. Click to expand... If you run debug mode, it should show you which variable or object has not been initialized. Upvote 0
davepamn said: Is there an easy way to find the variable that had an initialize method but was not invoked. Click to expand... If you run debug mode, it should show you which variable or object has not been initialized.
KMatle Expert Licensed User Longtime User Aug 18, 2014 #6 Let's say "simple objects" (you call them 'varibles') are DIMed and can be used after that (like DIM v as INT). Like a screwdriver or a hammer. You can take it and work with it. If you want to use a chair you have first to build it. This will be done with simple tools like a hammer. Initialize is like an "assemble". Upvote 0
Let's say "simple objects" (you call them 'varibles') are DIMed and can be used after that (like DIM v as INT). Like a screwdriver or a hammer. You can take it and work with it. If you want to use a chair you have first to build it. This will be done with simple tools like a hammer. Initialize is like an "assemble".
davepamn Active Member Licensed User Longtime User Aug 18, 2014 #7 Dim connectedDevice As NameAndMac I found the connectedDevice variable had an initialize, but not invoked. The code did not crash in release mode and I am not sure if this was the code that was crashing. I have added try and catch to isolate the location of the debug crash notification. Upvote 0
Dim connectedDevice As NameAndMac I found the connectedDevice variable had an initialize, but not invoked. The code did not crash in release mode and I am not sure if this was the code that was crashing. I have added try and catch to isolate the location of the debug crash notification.
davepamn Active Member Licensed User Longtime User Aug 18, 2014 #8 Sub Process_Globals Dim connectedDevice As NameAndMac end sub serial1.Connect(connectedDevice.Mac) This code seemed to work without the connectedDevice variable without being initialized. If connectedDevice.IsInitialized=False Then connectedDevice.Initialize End If When I tried to initialize connectedDevice, it shows already it is initialized. I had to use isInitialized to check the variable state. why? Last edited: Aug 18, 2014 Upvote 0
Sub Process_Globals Dim connectedDevice As NameAndMac end sub serial1.Connect(connectedDevice.Mac) This code seemed to work without the connectedDevice variable without being initialized. If connectedDevice.IsInitialized=False Then connectedDevice.Initialize End If When I tried to initialize connectedDevice, it shows already it is initialized. I had to use isInitialized to check the variable state. why?
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2014 #9 Custom types with only primitive fields can be used without initialization. However it is simpler and safer to initialize the type. Upvote 0
Custom types with only primitive fields can be used without initialization. However it is simpler and safer to initialize the type.