Calling Stack size in Userforms

S

spilly39

Pardon my ignorance, but Should I be worried about this?...

While developing a project with my first Userforms I've noticed that the
Calling stack icon shows something like a normal event stack, but with added
"non-Visual Basic code" entries.

It seems the number of call stack entries is affected by at least two
factors:
by coding a debugging Stop statement
by the number of Me.Hide / Me.Show pairs executed
(If you comment out the Show/Hides you get no entries for CButton1)

Paste the code below into a Userform with 2 big Command buttons and run the
form, you'll see what I mean.

My Question is
Should I be worried about consuming potentially infinite Stack space?
Or is this not a view of a real stack, but just a debugging aid with a
defined trace of (potentially nested) Shows of n userforms?

For quickness I started Task Manager/Performance graphs and watched the
memory line, but it was a flat line. That wasn't a proper test because I
didn't minimised external events which affect memory usage

Can someone please re-assure me about this?
My project is nearly ready for use by naive users
I want it as bomb proof as poss


spilly


Option Explicit

Private Sub CommandButton1_Click()
Me.Hide
'''''Do your VB stuff here
Me.Show
End Sub

Private Sub CommandButton2_Click()
Stop 'PLEASE LOOK AT THE CALL STACK NOW
End Sub

Private Sub UserForm_Initialize()

CommandButton1.Caption = "Simulate Event code"
CommandButton2.Caption = "Watch Call stack in VBE"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top