Tu n'as qu'à typé le paramètre avec le Nom du contrôle. Tu peux aussi le passé As Control mais ce sera plus lent et tu n'auras pas l'intellisense..
'*** ' MyControl est le nom du UserControl Private Sub MySub(ByRef ctl As MyControl) End Sub '***
-- Cordialement Yanick Lefebvre - MVP pour Visual Basic http://faq.vb.free.fr/?rubrique=0 - http://www.mvps.org/vbnet/ http://www.mentalis.org/agnet/apiguide.shtml - http://www.mztools.com/ "carole" wrote in message news:eOg$
Dans un projet VB6, Je désire passer en paramètre à une procédure globale, un objet UserControl.
Je passe déjà des objets feuilles en paramètres à des procédures, mais je n'ai pas trouve comment faire dans le cas d'un objet UserControl
merci de vos reponses
carole
non ca ne marche pas, j'ai essaye
"Zoury" wrote in message news:
Salut Carole! :O)
Tu n'as qu'à typé le paramètre avec le Nom du contrôle. Tu peux aussi le passé As Control mais ce sera plus lent et tu n'auras pas l'intellisense..
'*** ' MyControl est le nom du UserControl Private Sub MySub(ByRef ctl As MyControl) End Sub '***
-- Cordialement Yanick Lefebvre - MVP pour Visual Basic http://faq.vb.free.fr/?rubrique=0 - http://www.mvps.org/vbnet/ http://www.mentalis.org/agnet/apiguide.shtml - http://www.mztools.com/ "carole" wrote in message news:eOg$ > Dans un projet VB6, Je désire passer en paramètre à une procédure
globale,
> un objet UserControl. > > > > Je passe déjà des objets feuilles en paramètres à des procédures, mais
je
> n'ai pas trouve comment faire dans le cas d'un objet UserControl > > > > merci de vos reponses > > > > > >
non ca ne marche pas, j'ai essaye
"Zoury" <yanick_lefebvre@hotmail.com> wrote in message
news:OWqMJiDNEHA.2676@TK2MSFTNGP12.phx.gbl...
Salut Carole! :O)
Tu n'as qu'à typé le paramètre avec le Nom du contrôle. Tu peux aussi le
passé As Control mais ce sera plus lent et tu n'auras pas l'intellisense..
'***
' MyControl est le nom du UserControl
Private Sub MySub(ByRef ctl As MyControl)
End Sub
'***
--
Cordialement
Yanick Lefebvre - MVP pour Visual Basic
http://faq.vb.free.fr/?rubrique=0 - http://www.mvps.org/vbnet/
http://www.mentalis.org/agnet/apiguide.shtml - http://www.mztools.com/
"carole" <ccaro112@hotmail.com> wrote in message
news:eOg$VRBNEHA.3404@TK2MSFTNGP10.phx.gbl...
> Dans un projet VB6, Je désire passer en paramètre à une procédure
globale,
> un objet UserControl.
>
>
>
> Je passe déjà des objets feuilles en paramètres à des procédures, mais
je
> n'ai pas trouve comment faire dans le cas d'un objet UserControl
>
>
>
> merci de vos reponses
>
>
>
>
>
>
Tu n'as qu'à typé le paramètre avec le Nom du contrôle. Tu peux aussi le passé As Control mais ce sera plus lent et tu n'auras pas l'intellisense..
'*** ' MyControl est le nom du UserControl Private Sub MySub(ByRef ctl As MyControl) End Sub '***
-- Cordialement Yanick Lefebvre - MVP pour Visual Basic http://faq.vb.free.fr/?rubrique=0 - http://www.mvps.org/vbnet/ http://www.mentalis.org/agnet/apiguide.shtml - http://www.mztools.com/ "carole" wrote in message news:eOg$ > Dans un projet VB6, Je désire passer en paramètre à une procédure
globale,
> un objet UserControl. > > > > Je passe déjà des objets feuilles en paramètres à des procédures, mais
je
> n'ai pas trouve comment faire dans le cas d'un objet UserControl > > > > merci de vos reponses > > > > > >
Zoury
peut-on voir ton code? tu obtiens une erreur?
' voici un exemple qui fonctionne ici.. ' 1 projet ActiveX Exe ' 1 Form ' 1 projet ActiveX Control ' 1 UserControl ' ' projet ActiveX Exe '*** ' Form1 - Form ' 1 MyControl Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl) Debug.Print ctl.CryptedText End Sub
Private Sub MyControl1_Click() Call DoStuff(MyControl1) End Sub '*** ' ' projet ActiveX Control '*** ' MyControl - UserControl ' 1 CommandButton Option Explicit
Private m_sCryptedText As String Public Event Click()
Private Sub Command1_Click() RaiseEvent Click End Sub
Private Sub UserControl_Initialize() Call DoStuff(Me) End Sub
Private Sub UserControl_Resize() Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height) End Sub
Public Property Get CryptedText() As String CryptedText = m_sCryptedText End Property
Public Property Let Text(ByRef sText As String) m_sCryptedText = Chr$(Asc(sText) Xor 5) End Property
Private Sub DoStuff(ByRef ctl As MyControl) ctl.Text = "a" End Sub '***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre et ce dernier est bien typé
' voici un exemple qui fonctionne ici..
' 1 projet ActiveX Exe
' 1 Form
' 1 projet ActiveX Control
' 1 UserControl
'
' projet ActiveX Exe
'***
' Form1 - Form
' 1 MyControl
Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl)
Debug.Print ctl.CryptedText
End Sub
Private Sub MyControl1_Click()
Call DoStuff(MyControl1)
End Sub
'***
'
' projet ActiveX Control
'***
' MyControl - UserControl
' 1 CommandButton
Option Explicit
Private m_sCryptedText As String
Public Event Click()
Private Sub Command1_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
Call DoStuff(Me)
End Sub
Private Sub UserControl_Resize()
Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height)
End Sub
Public Property Get CryptedText() As String
CryptedText = m_sCryptedText
End Property
Public Property Let Text(ByRef sText As String)
m_sCryptedText = Chr$(Asc(sText) Xor 5)
End Property
Private Sub DoStuff(ByRef ctl As MyControl)
ctl.Text = "a"
End Sub
'***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre et
ce dernier est bien typé
' voici un exemple qui fonctionne ici.. ' 1 projet ActiveX Exe ' 1 Form ' 1 projet ActiveX Control ' 1 UserControl ' ' projet ActiveX Exe '*** ' Form1 - Form ' 1 MyControl Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl) Debug.Print ctl.CryptedText End Sub
Private Sub MyControl1_Click() Call DoStuff(MyControl1) End Sub '*** ' ' projet ActiveX Control '*** ' MyControl - UserControl ' 1 CommandButton Option Explicit
Private m_sCryptedText As String Public Event Click()
Private Sub Command1_Click() RaiseEvent Click End Sub
Private Sub UserControl_Initialize() Call DoStuff(Me) End Sub
Private Sub UserControl_Resize() Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height) End Sub
Public Property Get CryptedText() As String CryptedText = m_sCryptedText End Property
Public Property Let Text(ByRef sText As String) m_sCryptedText = Chr$(Asc(sText) Xor 5) End Property
Private Sub DoStuff(ByRef ctl As MyControl) ctl.Text = "a" End Sub '***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre et ce dernier est bien typé
public Sub Couleur_UserControl(Usr As UserControl) On Error GoTo error_color ' code ..... end sub
et l'appel a la procédure depuis un usercontrol :
Private Sub UserControl_Initialize() Couleurs_UserControl ucl_EICC End Sub
ucl_eicc est le nom du control : j'obtiens une erreur de compil, si je met "usercontrol" ala place j'ai une erreur aussi.
pour un objet form ca fonctionne tres bien :
Public Sub Couleur_Feuille(Feuille As Form) ' code end sub
appel depuis une feuille :
Private Sub Form_Load() Couleur_Feuille Me end sub
"Zoury" wrote in message news:%
peut-on voir ton code? tu obtiens une erreur?
' voici un exemple qui fonctionne ici.. ' 1 projet ActiveX Exe ' 1 Form ' 1 projet ActiveX Control ' 1 UserControl ' ' projet ActiveX Exe '*** ' Form1 - Form ' 1 MyControl Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl) Debug.Print ctl.CryptedText End Sub
Private Sub MyControl1_Click() Call DoStuff(MyControl1) End Sub '*** ' ' projet ActiveX Control '*** ' MyControl - UserControl ' 1 CommandButton Option Explicit
Private m_sCryptedText As String Public Event Click()
Private Sub Command1_Click() RaiseEvent Click End Sub
Private Sub UserControl_Initialize() Call DoStuff(Me) End Sub
Private Sub UserControl_Resize() Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height) End Sub
Public Property Get CryptedText() As String CryptedText = m_sCryptedText End Property
Public Property Let Text(ByRef sText As String) m_sCryptedText = Chr$(Asc(sText) Xor 5) End Property
Private Sub DoStuff(ByRef ctl As MyControl) ctl.Text = "a" End Sub '***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre e
public Sub Couleur_UserControl(Usr As UserControl)
On Error GoTo error_color
' code .....
end sub
et l'appel a la procédure depuis un usercontrol :
Private Sub UserControl_Initialize()
Couleurs_UserControl ucl_EICC
End Sub
ucl_eicc est le nom du control : j'obtiens une erreur de compil, si je met
"usercontrol" ala place j'ai une erreur aussi.
pour un objet form ca fonctionne tres bien :
Public Sub Couleur_Feuille(Feuille As Form)
' code
end sub
appel depuis une feuille :
Private Sub Form_Load()
Couleur_Feuille Me
end sub
"Zoury" <yanick_lefebvre@hotmail.com> wrote in message
news:%23pXtmBENEHA.1644@TK2MSFTNGP09.phx.gbl...
peut-on voir ton code?
tu obtiens une erreur?
' voici un exemple qui fonctionne ici..
' 1 projet ActiveX Exe
' 1 Form
' 1 projet ActiveX Control
' 1 UserControl
'
' projet ActiveX Exe
'***
' Form1 - Form
' 1 MyControl
Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl)
Debug.Print ctl.CryptedText
End Sub
Private Sub MyControl1_Click()
Call DoStuff(MyControl1)
End Sub
'***
'
' projet ActiveX Control
'***
' MyControl - UserControl
' 1 CommandButton
Option Explicit
Private m_sCryptedText As String
Public Event Click()
Private Sub Command1_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
Call DoStuff(Me)
End Sub
Private Sub UserControl_Resize()
Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height)
End Sub
Public Property Get CryptedText() As String
CryptedText = m_sCryptedText
End Property
Public Property Let Text(ByRef sText As String)
m_sCryptedText = Chr$(Asc(sText) Xor 5)
End Property
Private Sub DoStuff(ByRef ctl As MyControl)
ctl.Text = "a"
End Sub
'***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre e
public Sub Couleur_UserControl(Usr As UserControl) On Error GoTo error_color ' code ..... end sub
et l'appel a la procédure depuis un usercontrol :
Private Sub UserControl_Initialize() Couleurs_UserControl ucl_EICC End Sub
ucl_eicc est le nom du control : j'obtiens une erreur de compil, si je met "usercontrol" ala place j'ai une erreur aussi.
pour un objet form ca fonctionne tres bien :
Public Sub Couleur_Feuille(Feuille As Form) ' code end sub
appel depuis une feuille :
Private Sub Form_Load() Couleur_Feuille Me end sub
"Zoury" wrote in message news:%
peut-on voir ton code? tu obtiens une erreur?
' voici un exemple qui fonctionne ici.. ' 1 projet ActiveX Exe ' 1 Form ' 1 projet ActiveX Control ' 1 UserControl ' ' projet ActiveX Exe '*** ' Form1 - Form ' 1 MyControl Option Explicit
Private Sub DoStuff(ByRef ctl As MyControl) Debug.Print ctl.CryptedText End Sub
Private Sub MyControl1_Click() Call DoStuff(MyControl1) End Sub '*** ' ' projet ActiveX Control '*** ' MyControl - UserControl ' 1 CommandButton Option Explicit
Private m_sCryptedText As String Public Event Click()
Private Sub Command1_Click() RaiseEvent Click End Sub
Private Sub UserControl_Initialize() Call DoStuff(Me) End Sub
Private Sub UserControl_Resize() Call Command1.Move(0, 0, UserControl.ScaleWidth, UserControl.Height) End Sub
Public Property Get CryptedText() As String CryptedText = m_sCryptedText End Property
Public Property Let Text(ByRef sText As String) m_sCryptedText = Chr$(Asc(sText) Xor 5) End Property
Private Sub DoStuff(ByRef ctl As MyControl) ctl.Text = "a" End Sub '***
dans les 2 projets la fonction DoStuff() reçoit le controle en paramètre e