Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What Events fire when control is instantiated

Status
Not open for further replies.

SqueakinSweep

Programmer
Jun 20, 2002
945
GB
Im sure Im missing something obvious here. I worked with Foxpro for many years and the controls had events such as Load and Init, where Load fired before the form was available but Init fired once the form was instantiated. This event was available for every control on the form, if so desired.

In VB.NET, we have NEW. When using New on a control, if you try to use .FindForm in this event you get back Nothing, which is quite understandable. What I do need however is to trap an event which fires once the control and form is instantiated. The reason being is that my control needs to look at the form, to see which module it belongs to, and do some registry checking at this point for default values.

Here is the code I want to execute, and I want it to run before control.enter as I have it on now!

Code:
Dim fParent As fwControls.MyFormBase
fParent = CType(Me.FindForm, fwControls.MyFormBase)
Dim sModule As String = CStr(fParent.eModule)

I'd also be interested in any reference anyone has to the firing sequence of form load events.



Sweep
...if it works dont mess with it
 
It seems that the actual order of events can actually differ depending on how time consuming the initialization events are. Here's an article I read on it:


--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Thanks...I remember seeing this myself. You can see that the form has an Activated event, which seems to imply, that the form is instantiated. But is there an equivalent event for controls such as combo, textbox etc?


Sweep
...if it works dont mess with it
 
No, not as far as I am aware. Even in VB6 controls such as a ComboBox didn't have these events and this has been carried forward into .NET.

You've probably already seen most of these but these are the events in .NET for a ComboBox and what they do, although I'm not sure if they will be of any help to you! Sorry!


--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Thanks for the help guys.

Rick...I will look into the 2 events you mentioned, and if they achieve what Im after, will build them into a custom event from my subclassed combo.


Sweep
...if it works dont mess with it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top