Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control_Initialize Question
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00607874
Message ID:
00607912
Vues:
27
The Initialize event is raised before the form is completly loaded (somewhere between the Form_Initialize and Form_Load event). You cannot reference to the parent at this time.

Also, I would like to say that it is a very poor design to reference a public variable from a component. Your component must be completly isolated from the applications that use them to be usefull and easy to re-use.

>Sure, here it is.
>
>aPartCaptions is a single dimension public array loaded when the
>application starts up.
>
>
>Private Sub UserControl_Initialize()
>
> Dim iElement As Integer
> Dim sCaption As String
>
> For iElement = 0 To UBound(aPartCaptions)
>
>  sCaption = aPartCaptions(iElement)
>
>    If Alltrim(sCaption) <> "" Then
>
>      cboParts.AddItem sCaption
>
>    End If
>
>  Next
>
>End Sub
>

>
>When I double-click on the form with the combo control on it in the
>Project Window, I get a 'Subscript out of range error' on the line
>with the 'For'.
>
>The problem as I see it is that the UserControl_Initialize is firing
>when VB attempts to open the form with the control on it in the
>design window, but the array only exists in run-time.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform