Salut,
voici Form1.frm VERSION 5.00 Begin VB.Form Form1 BorderStyle = 3 'Fixed Dialog Caption = "Form1" ClientHeight = 3180 ClientLeft = 45 ClientTop = 375 ClientWidth = 2850 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3180 ScaleWidth = 2850 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default Begin VB.TextBox txtAffiche Height = 1485 Left = 368 MultiLine = -1 'True TabIndex = 1 Top = 1155 Width = 2115 End Begin VB.ComboBox cboTypeAffichage Height = 315 Left = 368 Style = 2 'Dropdown List TabIndex = 0 Top = 525 Width = 2115 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Form_Load() cboTypeAffichage.AddItem "" cboTypeAffichage.AddItem "Vol" cboTypeAffichage.AddItem "Agression" End Sub Private Sub cboTypeAffichage_Click() If cboTypeAffichage.ListIndex < 1 Then Exit Sub txtAffiche.Text = "date : " & LireINI(cboTypeAffichage.Text, "Date") txtAffiche.Text = txtAffiche.Text & vbCrLf & _ "Heure : " & LireINI(cboTypeAffichage.Text, "Heure") End Sub et ici le moduleINI.bas Attribute VB_Name = "FichierINI" Option Explicit Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long Function LireINI(Entete As String, Variable As String) As String Dim Retour As String Dim fichier As String fichier = App.Path & "\fichier.ini" Retour = String(255, Chr(0)) LireINI = Left$(Retour, GetPrivateProfileString(Entete, ByVal Variable, "", Retour, Len(Retour), fichier)) End Function Function EcrireINI(Entete As String, Variable As String, valeur As String) As String Dim fichier As String fichier = App.Path & "\fichier.ini" EcrireINI = WritePrivateProfileString(Entete, Variable, valeur, fichier) End Function et enfin fichier.ini [Vol] Date = 30.08.2005 Heure = 22.40 [Agression] Date = 20.08.2005 Heure = 02.15 Tu enregistres chacun dans un fichier texte que tu renommes avec le nom en gras et tu fais un projet avec ...
++
Zlub
|