econs
Messages postés4030Date d'inscriptionmardi 13 mai 2003StatutMembreDernière intervention23 décembre 200824 21 janv. 2004 à 14:18
Sur ton formulaire, tu places un drive (Drive1), un dirbox (dir1) et un filebox (File1), ainsi qu'un bouton (Command1)
*****************************************
code de la form
*****************************************
Public PREVIOUS_DRIVE As Long
Private Sub Command1_Click()
FaireQuelqueChose
End Sub
Private Sub Dir1_Change()
frmMain.lblPath = frmMain.Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo errHandler
frmMain.Dir1.Path = frmMain.Drive1.List(Drive1.ListIndex)
PREVIOUS_DRIVE = frmMain.Drive1.ListIndex
frmMain.lblPath = frmMain.Dir1.Path
Exit Sub
errHandler:
MsgBox "Périphérique non connecté ou vide", vbCritical
frmMain.Drive1.ListIndex = PREVIOUS_DRIVE
End Sub
Private Sub Form_Load()
PREVIOUS_DRIVE = frmMain.Drive1.ListIndex
frmMain.lblPath = frmMain.Dir1.Path
frmMain.File1.Path = frmMain.Dir1.Path
End Sub
Private Sub FaireQuelqueChose()
If frmMain.File1.ListIndex <> -1 Then
'ouvrir le fichier
Else
MsgBox "Veuillez sélectionner un fichier", vbCritical
End If
End Sub