Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
open text - URL document from listbox and determin which fil
#4
Full Source code to Project

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


Messages In This Thread
Re: open text - URL document from listbox and determin which - by Bradley - 04-24-2012, 11:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open Zip files into a listview box Worf 2 13,979 09-20-2014, 10:14 AM
Last Post: Worf
  Search ListBox + Convert ListBox.item to string brco900033 3 14,580 09-13-2012, 03:03 PM
Last Post: brandonio21
  Reading certain text from website. b_ongzhenyu 0 6,314 03-16-2012, 07:13 AM
Last Post: b_ongzhenyu
  Open a directory brco900033 6 22,450 11-09-2011, 09:32 PM
Last Post: chuckebaby

Forum Jump:


Users browsing this thread: 1 Guest(s)