Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection Problem
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00784441
Message ID:
00786058
Vues:
25
I forgot the 'NEW' keyword. Thanks for you expert help

Another question; I'm adding controls at runtime. I'm using the
VBControlExtender to trap a custom "Clicked" event in the control
i'm adding.

Yet the event is only trapped for the LAST control thats
added.

Any ideas?
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
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform