Bonjour,
J'ai écris ce tout petit programme pour retrouver un numéro de projet dans notre structure.
- Si le chemin possède des virgules ça ne marche pas. Je cherche..
- Est-ce qu'avec des with... je peux faire accélérer mon programme?
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim oProjNr As String = TextBox1.Text Dim oList1 As New Collection oList1.Add(My.Computer.FileSystem.GetDirectories(path)) Dim oList2 As New Collection Dim oList3 As New Collection Dim oString1 As String Dim oString2 As String Dim oString3 As String Dim oString4 As String For Each oString1 In oList1.Item(1) oList2.Add(My.Computer.FileSystem.GetDirectories(oString1)) For Each oString2 In oList2.Item(1) Dim testString As String = oString2 & "\" & oProjNr oList3.Add(My.Computer.FileSystem.GetDirectories(oString2)) For Each oString3 In oList3.Item(1) If oString3.Length > testString.Length Then oString4 = oString3.Remove(testString.Length) If testString = oString4 Then If My.Computer.FileSystem.DirectoryExists(oString3) Then Process.Start("explorer.exe", oString3) Exit Sub End If End If End If 'Debug.Print(oString3) Next oList3.Clear() Next oList2.Clear() Next End Sub
Partager