How to Get the Exe Files in a Directory and Run using VB.Net

The tutorial will teach you how to get the executable files and automatically run it by selecting in a drop down list.

You only need a Form and a Combo Box.


Here's the output


Code:

Imports System.IO
Public Class frmGetExe
    Private Sub frmGetExe_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.AddRange(Directory.GetFiles("C:\Windows\System32", "*.exe"))
    End Sub
    Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted
        Try
            Shell(ComboBox1.SelectedItem)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class
How to Get the Exe Files in a Directory and Run using VB.Net How to Get the Exe Files in a Directory and Run using VB.Net Reviewed by code-dev on 10:06 AM Rating: 5

No comments:

Powered by Blogger.