Ok, I know that the ActiveForm object returns the, well, active form. But what about the active form's controls I can't access those because they don't appear as one of the ActiveForm's objects, and when I try to compile like that it says that the property doesn't exist.
So how can I access the controls of the active form
Please help!

ActiveForm question
madkurt
nlitsme
oimtiaz
Oh!
I was declaring it in general declarations, of course I didn't test!
Dumb me.
But does that mean I will have to check EVERY SINGLE TIME I USE IT !
PK_Sean
Thank you! I feel much better now!!
Yknev05
Okay, I'm using the variable as a Public variable, and I'm only using one "type" of child form.
Public activeRTF As RTFDoc = DirectCast(Me.ActiveForm, RTFDoc)
Stefan Keir Gordon
VFI Support
The ActiveForm property returns a Form reference because it can be any type of form. You need to cast that reference to the appropriate type to be able to access the members of that type. If the ActiveForm may be any of several types then you're going to need to test what type it is before casting, e.g.:
Select Case True Case TypeOf Form.ActiveForm Is Form1 Dim myForm1 As Form1 = DirectCast(Form.ActiveForm, Form1) 'Use myForm1 here to access members of Form1 class. Case TypeOf Form.ActiveForm Is Form2 Dim myForm2As Form2 = DirectCast(Form.ActiveForm, Form2) 'Use myForm2 here to access members of Form2 class. Case TypeOf Form.ActiveForm Is Form3 Dim myForm3 As Form3 = DirectCast(Form.ActiveForm, Form3) 'Use myForm3 here to access members of Form3 class. End Selectlatas