Browse Folder

Xanatos - 25 sept. 2001 à 12:47
les french texans Messages postés 21 Date d'inscription mardi 14 juin 2005 Statut Membre Dernière intervention 23 octobre 2006 - 16 juin 2005 à 16:49
Je Cherche comment ouvrir le Selecteur de repertoire de windows avec ouverture sur un répertoire prédéfini.(Ex: qu'il s'ouvre sur "C:\MonRep").Merci d'avance.

5 réponses

Salut
Utilise le common dialogue box

Il possede plein de parametre a definir
et ouvre :
Method Dialog displayed
ShowOpen Open
ShowSave Save As
ShowColor Color
ShowFont Font
ShowPrinter Print
ShowHelp Invokes Windows Help

Bonne prog
@+ :)
0
ReSalu :)
Direct de la MSDN

The following code displays an Open dialog box and uses the selected file name as an argument to a procedure that opens a file:

[codeVB]
Private Sub mnuFileOpen_Click ()
' CancelError is True.
On Error GoTo ErrHandler
' Set filters.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text _
Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' Specify default filter.
CommonDialog1.FilterIndex = 2

' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
OpenFile (CommonDialog1.FileName)
Exit Sub

ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
[\codeVB]

@++ 8-)
0
Merci de m'avoir repondu.
Mais j'ai oublié de préciser que je ne voulais avoir dans le selecteur de repertoire que les repertoires et non les fichiers avec.
0
Salut
Mea Culpa,j'avais mal lu ;)
Tjrs de la MSDN (pas la page complete)

Each directory in the box has an integer identifier associated with it that allows you to identify individual directories. This capability is not provided by the common dialog control. The directory specified by the Path property (Dir1.Path) always has the ListIndex value of 1. The directory immediately above it has the ListIndex value of 2, the one above that of 3, and so on up to the root. The first subdirectory of Dir1.Path has the ListIndex 0. If there are multiple directories at the first subdirectory level, the next has the ListIndex value of 1, then 2, and so on, as shown in Figure 7.18.

Dir1.Path = Drive1.Drive

To set the current working directory, use the ChDir statement. For example, the following statement changes the current directory to the one displayed in the directory list box:
ChDir Dir1.Path
ChDrive App.Path ' Set the drive.
ChDir App.Path ' Set the directory.
Note The Path property is available only at run time, not at design time.

Bonne prog
PS:Tu peux me demander la page complete :)
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
les french texans Messages postés 21 Date d'inscription mardi 14 juin 2005 Statut Membre Dernière intervention 23 octobre 2006
16 juin 2005 à 16:49
Voila bonjour tout le monde
je suis en vb et je voudrais savoir comme faire pour obtenir a l'aide d'une common dialogue box le nom d'un repertoire?
Merci bcp
0
Rejoignez-nous