Hi kids! It's your favorite bitter programmer again. :)
My latest excursion is an attempt to center one form on top of another. Since the MS supplied Messagebox blows, I created a form that does the same thing (but looks appropriately cool) liike so:
Function NetMsgBox(Message as String,Title as String, Caption as String, BoxType as Integer) as Boolean
When this opens up I'd like it centered over the parent form. Problem is, determining the parent form from the load of this one. In the form_load for the msgbox I attempted this:
XCoord = (Me.ParentForm.Width / 2) - (Me.Width / 2)
YCoord = (Me.ParentForm.Height / 2) - (Me.Height / 2)
It seems logical but 'parentform' is not defined. Apparently this property is for MDI applications, which mine isn't. I could pass a reference from the calling form but I'd rather not add another parameter to the function.
Is there an easy way of determining the screen area of the parent or calling form or the entire screen itself? Should I just pass the reference from the parent through a global variable? Or is there some property of method I'm missing that makes this simple?