>Private WithEvents oGroup As VBControlExtender >Public Groups As New Collection > >Public Function AddGroup(Caption As String) As Object > > Dim sName As String > Dim iTotGroups As Integer > > iTotGroups = Groups.Count + 1 > sName = "Group" + LTrim(Str(iTotGroups)) > > Set oGroup = Controls.Add("MyProject.crlGroup", sName) > > With oGroup > > .Alignment = 1 > .Caption = Caption > .Left = 10 > .Top = 10 + (iCurrentGroup * GroupHeight) > .Height = GroupHeight > .Width = UserControl.Width - 23 > .IndexValue = iTotGroups > .Visible = True > > End With > > ' Add the group to the collection here > Groups.Add oGroup, sName > > Set AddGroup = oGroup > > >Private Sub oGroup_ObjectEvent(Info As EventInfo) > > ' The name of the event > Select Case Info.Name > > Case "Clicked" > > ' Read in parameters passed to the Clicked event here > MsgBox Info.EventParameters("Index").Value > > ' Handle unknown events here. > Case Else > > End Select > >End Sub >