PDA

Click to See Complete Forum and Search --> : load a form in OCX


trc_007
Jul 15th, 2003, 01:39 PM
I am a novice in VB. I have written an ActiveX control in VB6.0 which loads a form ( or atleast that was my intention). Here is the function in the ocx.

Public Function ocxMain1()
MsgBox "In VB OCX before calling form load"
MyForm.Show
End Function

MyForm is a form in the ocx. The form has 3 to 4 buttons which perform some screen capturing functions. I have written a VC++ client that calls the ocx function. It correctly displays the message box but gives a 'Runtime Error' in the MyForm.show line.

Can anyone enlighten me why this error is generated. My understanding is that forms can be loaded in an OCX. is this correct? If so, what is the right way to load a form? I appreciate the help.

crptcblade
Jul 15th, 2003, 05:46 PM
What is the actual error? (Number/Description)

trc_007
Jul 15th, 2003, 07:44 PM
There isn't a specific Error number shown. A message box appears with the following information.


"Runtime Error!

The application has requested the Runtime to terminate it in an unusual way. Please contatct the application's support team for more information."

Thats all it says. So I was wondering whether the problem arises because we are trying to open a form in an OCX from a different application(here it is a VC++ client ).

Hope this helps!

thanks

hassa046
Jul 17th, 2003, 06:52 AM
Originally posted by trc_007
There isn't a specific Error number shown. A message box appears with the following information.


"Runtime Error!

The application has requested the Runtime to terminate it in an unusual way. Please contatct the application's support team for more information."

Thats all it says. So I was wondering whether the problem arises because we are trying to open a form in an OCX from a different application(here it is a VC++ client ).

Hope this helps!

thanks

I guess you have to use MyForm.Show vbModal

;-)