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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| Imports System.IO
Public Class Form1
Private Property ListBoxFiles As Object
Private Property HandledMouseEventArgs As Object
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'ListBox1.Items.AddRange(IO.Directory.GetFiles("C:\Test"))
ListBox1.DataSource = Directory.GetFiles("C:\Test")
Dim files() As String = System.IO.Directory.GetFiles("C:\Test")
For i = 0 To files.Length - 1
files(i) = Path.GetFileName(files(i))
Next
ListBox1.DataSource = files
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
'Boutton > Clear de Textbox1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Clear()
End Sub
'Boutton Open Files
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
ListBox1.SelectedItems.Add(TextBox1.Text)
End Sub
'Code en ereure le Filtrage ne fonctionne pas
'Filtre de recherche
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox1.Items.Clear()
Dim count As Integer = (ListBox1.Items.Count - 1)
Dim words As String
For a = 0 To count
words = ListBox1.Items.Item(a)
If InStr(words.ToLower, TextBox1.Text.ToLower) Then
ListBox1.Items.Add(words)
End If
Next
End Sub
'Enregistrement de la Liste 2
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Diagnostics.EntryWrittenEventArgs) Handles EventLog1.EntryWritten
Dim Filename As String = "C:\Test\essais.txt"
My.Computer.FileSystem.WriteAllText(Filename, ListBox1.Text, True)
End Sub
Private Function driveList() As Object
Throw New NotImplementedException
End Function
Private Function FolderList() As Object
Throw New NotImplementedException
End Function
'Boutton > Actiualiser List 1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ListBox1.DataSource = Directory.GetFiles("C:\Test")
Dim files() As String = System.IO.Directory.GetFiles("C:\Test")
For i = 0 To files.Length - 1
files(i) = Path.GetFileName(files(i))
Next
ListBox1.DataSource = files
End Sub
Private Function DriveInfo() As Object
Throw New NotImplementedException
End Function
Private Function ListBox1Files() As Object
Throw New NotImplementedException
End Function
'Boutton 5 > Quit
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Close()
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Process.Start("X:\Dossiers\fichier.doc")
End Sub
End Class |
Partager