It sounds like you might be making things more complicated than they may need to be...and emulating keystrokes is generally not a good idea (though I admit that I have done this before). When using SendKeys API you can encounter different behavior on different systems and environments, so it is generally better to inherit and/or trap events or take an approach that will breed consistent results. At any rate, let me address your questions: What method always gets executed when the for is shown? The OnShown only seems to occur the 1st time the CusomerMaintence for is shown.
Yes, the OnShown will only be raised once when the form is shown. You may be more interested in looking into something like the OnActivated event...I really don't know exactly what you are trying to do, but the OnActivated will be raised each time the form is activated. You can also look through the MSDN documentation or the object browser to see all of the form events and how those events react.
[quote]How do I set up a public Boolean variable such as "addMode" that can be set to true if the user clicks NEW on the BrowseInforPanel that can be accesses from the CustomerMaintenance method the is always triggered when the CustomerMaintenance form is displayed.[/quote]
You don't want to create a public variable but a shared property. This is the same basic concept but a much safer and cleaner way to approach a shared (or global) type of value:
Public Class MyClass
Private Shared _MyValue As Boolean = False
Public Shared Property MyValue() As Boolean
Get
Return _MyValue
End Get
Set (Byval value As Boolean)
_MyValue = value
ENd Set
End Property
End Class
You could then access that property from anywhere. In the above case, you would access it like this:
MyClass.MyValue = True
Notice that I do not first need to create an instance...this is important because it is a shared property and will not support more than one instance, thus it will be automatically instantiated and then accessible from anywhere that has access to the definition of the class/property.