Créer un usercontrol genre data ou adoddc

cs_310 Messages postés 21 Date d'inscription dimanche 6 août 2006 Statut Membre Dernière intervention 28 avril 2012 - 6 oct. 2008 à 19:17
cs_310 Messages postés 21 Date d'inscription dimanche 6 août 2006 Statut Membre Dernière intervention 28 avril 2012 - 7 oct. 2008 à 21:23
S.V.P quelqu'un peut il m'aider à créer un usercontrol comme celui de "data"
vous allez me dire le control data existe déja , je suis d'accord mais c'est j'aimerais le créer moi meme .
question d'apprendre , et surtout quand il s'agit de créer ses propriétées comme databasename et recordsource etc..
                            et merçi
 

2 réponses

PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
6 oct. 2008 à 21:36
salut,

oui sans doute...
et tu en es où?
tu bloques sur quel point?
quel est ton code actuel?

<hr size="2" width="100%" />
Prenez un instant pour répondre à [sujet-SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp
0
cs_310 Messages postés 21 Date d'inscription dimanche 6 août 2006 Statut Membre Dernière intervention 28 avril 2012
7 oct. 2008 à 21:23
voila je vous envoie un morceau de code à vous de corriger
'**********************
Option Explicit
Public m_CNecriture As ADODB.Connection
Public m_rsecriture As ADODB.Recordset
Dim m_recordset As String
Dim FileName As Variant
Dim m_m_rsecriture
Dim m_connection As connectionconstants
Dim a_align
Dim cursortype
'*****************
Public Enum connectionconstants
Access
Access2000
DBaseIII
DBaseIV
DBase5
Excel3
Excel4
Excel5
Excel8
FoxPro2
FoxPro25
FoxPro26
FoxPro3
Lotuswk1
End Enum
Event align()
Event resize()
Event Click()
Event MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
Event MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
Event MouseMove(button As Integer, shift As Integer, x As Single, y As Single)


Private Sub Text1_Change()


End Sub


Private Sub UserControl_Resize()
cmdmove0.Move 0, 0, ScaleWidth / 12, ScaleHeight
cmdmove1.Move ScaleWidth / 12, 0, ScaleWidth / 12, ScaleHeight
Text1.Move ScaleWidth / 6, 0, ScaleWidth * 2 / 3, ScaleHeight
cmdmove2.Move ScaleWidth * 5 / 6, 0, ScaleWidth / 12, ScaleHeight
cmdmove3.Move ScaleWidth * 11 / 12, 0, ScaleWidth / 12, ScaleHeight
End Sub
Private Sub cmdmove0_Click()
If Not rsrecencpass.BOF Then
rsrecencpass.MoveFirst
Else: Beep
End If
End Sub


'Private Sub cmdmove1_Click()
'
'If Not rsrecencpass.bOF Then
'rsrecencpass.moveprevious
'Else: Beep
'End If
'End Sub


'Private Sub cmdmove2_Click()
'
'If Not rsrecencpass.EOF Then
'rsrecencpass.movenext
'Else: Beep
'End If
'
'End Sub


'Private Sub cmdmove3_Click()
'If Not rsrecencpass.EOF Then
'rsrecencpass.movelast
'Else
'Beep
'End If
'
'End Sub
'*************************************************************************************
Private Sub UserControl_Initialize()
Set m_CNecriture = New ADODB.Connection
m_CNecriture.Provider = "microsoft.jet.oledb.4.0"
m_CNecriture.ConnectionString = App.Path & "\inspection.mdb"
m_CNecriture.Open
Set m_rsecriture = New ADODB.Recordset


m_m_rsecriture = "m_rsecriture.Open ""SELECT ETABLISEMENTS.CODEETAB ," & _
"ETABLISEMENTS.ETABLISSEMENT, INSPECTIONRAPPORT.annescolaire," & _
"INSPECTIONRAPPORT.som,INSPECTIONRAPPORT.dateinspection,INSPECTIONRAPPORT.genre, INSPECTIONRAPPORT.note, " & _
"INSPECTIONRAPPORT.CODEETAB,INSPECTIONRAPPORT.nominspecteur, INSPECTIONRAPPORT.rappor," & _
"proffesseurs.som, proffesseurs.nom, proffesseurs.cadre," & _
"proffesseurs.deleg, proffesseurs.acad, proffesseurs.cycle," & _
"proffesseurs.tele " & _
"FROM proffesseurs INNER JOIN (ETABLISEMENTS INNER JOIN INSPECTIONRAPPORT ON ETABLISEMENTS.[CODEETAB] = INSPECTIONRAPPORT.[CODEETAB])" & _
"ON proffesseurs.[som] = INSPECTIONRAPPORT.[som] order by annescolaire desc;"", m_CNecriture, adOpenDynamic, adLockOptimistic"


End Sub


Public Property Get recordsource() As String
recordsource = m_m_rsecriture
End Property


Public Property Let recordsource(ByVal vNewrceordset As String)
m_m_rsecriture = vNewrceordset
PropertyChanged "recordset"
End Property


Public Property Get connect() As connectionconstants
 connect = m_connection
End Property


Public Property Let connect(ByVal New_connect As connectionconstants)


 m_connect = New_connect


PropertyChanged "connect"
End Property


Private Sub UserControl_Terminate()
Set m_m_rsecriture = Nothing


Set m_CNecriture = Nothing
End Sub


Public Property Get DataMember(DataMember As String, Data As Object)


Set Data = m_rsecriture
End Property


Public Property Let DataMember(DataMember As String, Data As Object, ByVal newvalue As Variant)


m_rsecriture = DataMember
PropertyChanged "datamember"
End Property
Public Property Get Caption() As String
Caption = Text1.Text
End Property


Public Property Let Caption(ByVal New_caption As String)
Text1.Text = New_caption
PropertyChanged "caption"
End Property
Private Sub sadata_readproperties(propbad As PropertyBag)
sadata1.Caption = propbag.ReadProperty("caption", "sadata1")
sadata1.Connection = propbag.ReadProperty("connection", "sadata1")
'Text1.Enabled = propbag.ReadProperty("Visible", True)
End Sub
Private Sub sadata1_writeproperties(propbad As PropertyBag)
Call propbag.WriteProperty("caption", sadata1.Caption, "sadata1")
Call propbag.WriteProperty("connection", sadata1.Connection, "sadata1")
'Call propbag.WriteProperty("Visible", Text1.Enabled, True)
End Sub


'Public Property Get Visible() As Boolean
'Visible = Text1.Enabled


'End Property


'Public Property Let Visible(ByVal New_enabled As Boolean)
'Text1.Enabled() = New_enabled
'End Property




Public Property Let databasename(ByVal vNewValue As Variant)
 Database(dlg, True) = vNewValue
PropertyChanged "DataBaseName"
End Property
'Public Enum AlignConstants
'AlignNone
'AlignTop
'AlignBottom
'AlignLeft
'AlignRight
'End Enum
Public Property Get align() As AlignConstants


 


align = a_align
End Property


Public Property Let align(ByVal New_align As AlignConstants)




a_align = New_align
End Property


Public Property Get DefaultTypeCursor() As LockTypeEnum
DefaultTypeCursor = cursortype
End Property


Public Property Let DefaultTypeCursor(ByVal New_defaultcursor As LockTypeEnum)
cursortype = New_defaultcursor
End Property
0
Rejoignez-nous