Advertisement
ElCris009

Tutorial | Como Insertar una Lista de Archivos a un ListBox

Jul 11th, 2019
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.03 KB | None | 0 0
  1. Referencia: https://www.youtube.com/watch?v=C_IHyLdsl_I
  2.  
  3. Para cargar los archivos:
  4.         Dim Folder As New FolderBrowserDialog
  5.         Folder.Description = "DESCRIPCION AQUI"
  6.         Folder.ShowNewFolderButton = False
  7.         Folder.SelectedPath = "C:\"
  8.         Try
  9.             For Each Archivo As String In My.Computer.FileSystem.GetFiles(
  10.                                     "C:\",
  11.                                      FileIO.SearchOption.SearchAllSubDirectories,
  12.                                     "*.Formatos", "*.AQUI")
  13.                 ListBox1.Items.Add(Archivo)
  14.             Next
  15.         Catch oe As Exception
  16.             MsgBox(oe.Message, MsgBoxStyle.Critical, "El Codigo es como tu Vida, Llena de Errores xD")
  17.         End Try
  18.  
  19. Para eliminar un archivo:
  20.         If e.KeyCode = Keys.Delete And ListBox1.Items.Count  0 And ListBox1.SelectedIndex  -1 Then
  21.             Dim a As Integer = ListBox1.SelectedIndex
  22.             ListBox1.SelectedIndex = a
  23.             ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
  24.         End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement