Imports System.IO Imports System.Net Imports System.Diagnostics.Process Public Class _Default Inherits System.Web.UI.Page Dim path As String = ConfigurationManager.AppSettings("filepath") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If (Not IsPostBack) Then Dim di As DirectoryInfo = New DirectoryInfo(path) Dim fidir As FileInfo() = di.GetFiles() Dim fi As FileInfo For Each fi In fidir lstbx_file.Items.Add(fi.FullName) Next End If End Sub Protected Sub lstbx_file_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstbx_file.SelectedIndexChanged Dim fname As String Dim x As New _Default fname = System.IO.Path.Combine(x.path, lstbx_file.SelectedValue.ToString()) Dim p As New Process() p.Start(fname) p.Close() p.Dispose() End Sub End Class
Dim p As New Process() p.Start(fname) p.Close() p.Dispose()
Dim p As Process = Process.Start(fname) p.WaitForExit() ' Might want to use a timeout here p.Dispose()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)