Sorry Erel, I didnt explain myself very well.
BaseList is a List of custom types (GaugeBase). One of the elements in GaugeBase is a Canvas. These are both global to the application.
Sub Globals
Type GaugeBase(pBase As Panel, cBase As Canvas,cBmp As Canvas)
Dim BaseList As List
...
In the NewGauge Sub, I Dim and Initialise a new GaugeBase and add it to BaseList.
Sub NewGauge(X As Int,y As Int,w As Int,h As Int)
Dim Newp As Panel
Dim Newc As Canvas
Dim Newgb As GaugeBase ' Custom type
Newgb.Initialize
BaseList.Add(Newgb)
End Sub
BaseList now contains a reference to Newgb which was dimed in the Sub.
What I dont understand is, why that reference is not broken when the Sub ends.
In all the other pass-by-reference languages I have used, if you pass a reference to a variable created in a subroutine and then try to access it after the sub has ended, you would get a runtime error.
I am not saying that I think this is wrong, I just want to know how this mechanism works. Does the locally created object/variable stay in memory?
Terry