Click to See Complete Forum and Search --> : user control


anita_vs
June 14th, 2001, 02:24 PM
Hi All!

I Need Help for user control.

I am tring to call a "Form" from user control
but it is giving error.

In user control I wrote this code

Sub cmdOk_click()

frmTest.Show vbModal, Me
If ModalOutput Then
strMonth = frmTest.MonthView.Month
strDate = frmTest.MonthView.Day
else
exit sub
end if
End sub

The "Form" consists of "MothView control"

Private Sub cmdOK_Click()
ModalOutput = True
Hide
End Sub

Is this Possible?

If not what is requried?

Thanks In Advance
Anita

John G Duffy
June 14th, 2001, 02:44 PM
What knd of error are you getting???
THe Hide does not seem correct. Maybe it should be ME.Hide or FormName.Hide

John G

anita_vs
June 14th, 2001, 03:14 PM
Hi!

I am getting 2 errors.

1. Run time error '424':
Object requried

2. Runtime Error '364':
object was unloaded

Anita

anita_vs
June 14th, 2001, 05:42 PM
I tried this also

In Module I added this code

Public fTest as frmTest

And in usercontrol

Private Sub UserControl_Initialize()

set fTest = new frmtest
load fTest

end if

If I do this I am not able to place control on "Form"

Error '91'
Object or block variable not set

Ofcourse I changed Hide as formname.hide

Anita

John G Duffy
June 15th, 2001, 08:55 AM
I may be wrong on this, but it looks like you have the frmTest outside of your user Control project. I think It must be contained within the User COntrol project.
I have a Skeleton User Control sample that is structured like this and I have no problems

+ Skeleton Project(Skeleton.vbp)
Form1(Form1)
Skeleton(Skeleton.ctl)
+ TestProject(TestProject.vbp)
Test (Test.frm)
'
'Test form calls Skeleton.ctl which does a Form1.Show with no problem.

John G

anita_vs
June 15th, 2001, 01:58 PM
Hi John,

Thanks for replay.

I am using a thirdparty control in Usercontrol.
& I am tring to access that from "Form".(putting values into listbox-using that i am doing other process).

If i don't access that component then it works but if I use
set comp=NameofProject.component.method(or property)

It gives error '9' while placing usercontrol on test form

I am able to see methods & properties when I use
ProjectName.

Thanks,
Anita

John G Duffy
June 15th, 2001, 06:32 PM
I would get back to the author of the third party control for suggestions on how to do that. If you have no problems adding Microfost standard controls to the form, then I suggest it probably is inherent in the third party control.
'
'
Suggestion. Try doing the same thing with a Microsoft supplied control to see what happens.

John G

anita_vs
June 15th, 2001, 07:37 PM
Thanks John!

I passed that object to that form.
It is working fine

Anita