M Mike Maurice Member Licensed User Longtime User May 14, 2013 #1 Sub Globals or Process_Globals Dim Button1 As Button Dim Button1 As Button No error. This also applies to other types: Int, Byte, etc. Ver 2.70.
Sub Globals or Process_Globals Dim Button1 As Button Dim Button1 As Button No error. This also applies to other types: Int, Byte, etc. Ver 2.70.
NJDude Expert Licensed User Longtime User May 14, 2013 #2 That's not a problem, since you can re-DIM variables.
agraham Expert Licensed User Longtime User May 14, 2013 #3 Sometimes you NEED to re-Dim a variable to get a new instance of an object after you have used the previous one B4X: For I = 0 to 9 Dim b as Button ' make a new Button instance b.Initialize("SomeEventName") ... ' do something with it like add it to a View Next If the Dim b As Button was outside the For loop you would be using the same Button all the time which would probably not be what was intended.
Sometimes you NEED to re-Dim a variable to get a new instance of an object after you have used the previous one B4X: For I = 0 to 9 Dim b as Button ' make a new Button instance b.Initialize("SomeEventName") ... ' do something with it like add it to a View Next If the Dim b As Button was outside the For loop you would be using the same Button all the time which would probably not be what was intended.