|
-
Jul 27th, 2018, 10:01 AM
#23
New Member
Re: [RESOLVED] UserControl with form
Hi Eduardo
I have the solution:
In the main Exe I have a blank form:
Private WithEvents objCtrExt As VBControlExtender
Private Sub Form_Load()
Set objCtrExt = Controls.Add("MyOcx.MyControl", "MyControl")
objCtrExt.Visible = True
objCtrExt.Tag = Me.Tag
End Sub
Private Sub Cmd_Click(Index As Integer)
Select Case Index
Case 1 ' Go to previous record
objCtrExt.object.PrevRec
Case 2 ' Go to next record
objCtrExt.object.NextRec
End Select
End Sub
-------------------------------------------------------------------------
In the UserControl (MyControl in MyOcx) I have:
Public Sub PrevRec()
PrevRec_UC
End Sub
Public Sub NextRec()
NextRec_UC
End Sub
I resolved the problem using the keyword object: objCtrExt.object.PrevRec
In this way from the form in the Exe is possible to call the sub in the OCX. Now it works very well.
Anyway thank you for your interest and for your help.
Bye.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|