VB Tutorial
Tools
Free Downloads
Free Link Directory

Basics
Data Types
Windows Forms
Buttons
Check Box
Text Box
Combo Box
Radio Buttons
Progress Bar
Color & Font Dialogs
Open & Save Dialogs
Process Control

More Complex Examples
Audio Player
Rotating Rectangle

 

Open a folder with Process control in vb.net

Processes


Process controls can be used to enable start and stop different processes or applications. It can access processes both local and remote. To give you an idea of how to use the process control we will create a small example.
Start by creating a new project. Double click on the Button icon in the Toolbox to create a button on the form. In the forms Load event change button1's text to "Open Folder".

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Open Folder"
End Sub

Create a new Sub and call it MyProcess. We are going to use our process to open any folder(we have access to) on our computer. To do this we are going to make use of Windows Explorer and simply pass the folders name to it. To do that we have to create the following commands for our process.

Sub MyProcess()
Process1.StartInfo.FileName = "Explorer.exe"
Process1.StartInfo.Arguments = FolderBrowserDialog1.SelectedPath
Process1.Start()
End Sub

When we push our button we want our FolderBrowser to open so that we can select our folder. Then only if the FolderBrowserDialog returns "Ok" we will call our sub called MyProcess and run the commands in it. Double click on your button to open its event handling procedure.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
MyProcess()
End If
End Sub

Remenber to put all of the above code inside your Class. Between Public Class Form1 and End Class. If you liked this article then Please Thumb This Up with a short review - Stumble It!
Continue to the next page.

 


Email us at: info@pro2visual.com
 

 

Popular Articles

Moving a borderless form in vb.net

ComboBox1.Items.Add

Link Progress Bar with Timer in vb.net

How to open a folder using the process control

Start Vb.net programming. No get rich quick scam

How to Convert the Date Format

Click here for Industry Leading Development Softwa