Get all exe files (VB) : Directory « File Directory « ASP.Net






Get all exe files (VB)

<%@ Page Language="VB" %>
<%@ import Namespace="System.IO" %>
<script runat="server">
  Sub Page_Load(Sender As Object, E As EventArgs)
    If Not IsPostBack Then

      Dim FileCollection As String()
      Dim myFileInfo As FileInfo
      Dim i as integer
      
      FileCollection = Directory.GetFiles("C:\WINNT","*.exe")
      For i = 0 To FileCollection.Length - 1
        myFileInfo = New FileInfo(FileCollection(i))
        FileListBox.Items.Add(new ListItem(myFileInfo.Name.ToString()))
      Next
    End If
  End Sub
</script>
<html>
  <head>
  </head>
  <body>
<form runat="server">
  EXE Files in Folder C:\WINNT:
  <asp:ListBox id="FileListBox" Runat="Server" />
</form>
  </body>
</html>

 








Related examples in the same category

1.Get all exe files (C#)