open text - URL document from listbox and determin which fil - Printable Version +- BP Forums (https://bpforums.info) +-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55) +--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56) +---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8) +----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9) +----- Thread: open text - URL document from listbox and determin which fil (/showthread.php?tid=522) |
open text - URL document from listbox and determin which fil - Bradley - 04-23-2012 Developers My name is Bradley and I have been developing for 2 years now using visual basic 2008 express edition I am also a developer and use assembly programming language. Problem I have a listbox that displays all files in a spersific directory and already have the code for showing the files and there extentions the probelm I am faceing is when I go to open a file some are URL and some are .doc and it don't know which one to open I need a peace of code that will allow to be open the file and it automaticly detects its exttention so any file for .doc = moduel 1.main and for URL goes to moduel 2.main here is the code so far Moduel 1 Module Module1 Code: Sub Main() Moduel 2 Module Module2 Code: Sub Main() Load form1 Code: For Each FileStr As String In IO.Directory.GetFiles("C:\Travel", "*.*") open Button1 Code: If ListBox1.SelectedItem = "*.doc" Then any thoughts on what I could do or that I am doing wrong will be appricated and notied Many Thanks Re: open text - URL document from listbox and determin which - brandonio21 - 04-24-2012 Hello Bradely, Have you tried using the Code: Path.GetExtension(Path) Re: open text - URL document from listbox and determin which - Bradley - 04-24-2012 Many thanks this worked perfect and project is now completed thanks to your help I am most greatful and sure I will be back to help others and get more help lol I new it had to be simple it just depends what and that was the answer all the best. Bradley Re: open text - URL document from listbox and determin which - Bradley - 04-24-2012 Full Source code to Project Imports Code: Imports System.IO Moduel 1 Code: Module moduel1 Moduel 2 Module Module2 Code: Sub Main() Form1 Load Code: Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Open Button Code: Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click 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 Re: open text - URL document from listbox and determin which - brandonio21 - 04-25-2012 Awesome! Great work! |