04-24-2012, 11:01 PM
Full Source code to Project
Imports
Moduel 1
Moduel 2
Module Module2
Form1 Load
Open Button
Get Path Button this can be used for mouse down also
Imports
Code:
Imports System.IO
Moduel 1
Code:
Module moduel1
Sub Main()
OpenMicrosoftWord("C:\Travel\" & form1.ListBox1.SelectedItem.ToString)
End Sub
Private Sub OpenMicrosoftWord(ByVal f As String)
Dim startInfo As New ProcessStartInfo
startInfo.FileName = "WINWORD.EXE"
startInfo.Arguments = f
Process.Start(startInfo)
End Sub
End Module
Moduel 2
Module Module2
Code:
Sub Main()
Process.Start("C:\Travel\" & Form1.ListBox1.SelectedItem.ToString)
End Sub
End Module
Form1 Load
Code:
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each FileStr As String In IO.Directory.GetFiles("C:\Travel", "*.*")
ListBox1.Items.Add(IO.Path.GetFileName(FileStr))
Next
End Sub
Open Button
Code:
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
If TextBox1.Text = ".doc" Then
moduel1.Main()
End If
If TextBox1.Text = ".url" Then
Module2.Main()
End If
End Sub
Get Path Button this can be used for mouse down also
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = Path.GetExtension("C:\Travel" & ListBox1.SelectedItem.ToString)
End Sub