|
-
Apr 15th, 2010, 03:04 AM
#1
Thread Starter
Fanatic Member
End a process
Hi
I have a TextBox in which the user enters the filename of the file that he wants to display and a Button
I am using the process class to open files of any type(.xls,.pdf,.doc,.xml)...
when the user clicks on a button, it displays the filename mentioned in the textbox,and if he presses on the button for a second time and the textbox has changed,it should close the previous file and then open the new file.
how can I do that so only one file is opened?(If the first file is an excel and the second filename is a txt document, then I should close the excel file and then open the text document)
the code I am using is:
Code:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports System.Diagnostics
Namespace WindowsFormsApplication3
Public Partial Class Form1
Inherits Form
Private p As New Process()
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
p.StartInfo = New System.Diagnostics.ProcessStartInfo(textBox1.Text)
p.Start()
End Sub
End Class
End Namespace
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|