Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Select Shortcut path in VB.NET
Old 12-08-2008, 01:12 PM Select Shortcut path in VB.NET
Experienced Talker

Posts: 35
Name: remya
Trades: 0
i'm using VB.NET 2003 application program.

by using OpenFileDialog, we can select the file name or file path.
Code:
        OpenFileDialog1.ShowDialog()
        pgmPath.Text = OpenFileDialog1.FileName
by using FolderBrowserDialog, we can select the folder name or folder path.
Code:
         FolderBrowserDialog1.ShowDialog()
        folderPath.Text = FolderBrowserDialog1.SelectedPath
is there a way i can select shortcut. i just want to select shortcut for a folder. but when i used FolderBrowserDialog, it show only the folder list. its not showing the shortcut i have.

Quote:
for example: in desktop i have 4 folders, 1 EXE shortcut and 1 folder shortcut. but when i open FolderBrowserDialog it shows only 4 folders, not showing the 2 shortcuts.
a way i can show files that end with ".lnk" and select that shortcut. is there a way i can select shortcut's...

and by using this shell command i tried to open the EXE's.
Code:
ProgramPath = "C:\Programs\Application1.exe"
Shell(Chr(34) & ProgramPath & Chr(34), AppWinStyle.NormalFocus)
and it works fine with all the EXE to get opened.

but when i tried to open a shortcut using the same shell comment
Code:
ProgramPath = "C:\Programs\App.lnk"
Shell(Chr(34) & ProgramPath & Chr(34), AppWinStyle.NormalFocus)
error occurs... "File Not Found"

is there a way i can open the shortcut.

if anyone have any idea how to select shortcut (files that end with ".lnk") and a way i can open the shortcut, please help me. if you can provide any help, then that will be great help for me...

Thanks in advance.
remya1000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-08-2008, 03:12 PM Re: Select Shortcut path in VB.NET
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
If it's possible, it'll be through the file and not folder dialog, since a shortcut is a type of file. Set the filter to "*.lnk" to display only shortcut files (and folders and drives).
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 12-08-2008, 04:32 PM Re: Select Shortcut path in VB.NET
Experienced Talker

Posts: 35
Name: remya
Trades: 0
as you said i tried to filter *.lnk

Code:
OpenFileDialog1.Filter = "(*.lnk)|(*.exe)"
OpenFileDialog1.ShowDialog()

its start showing the Shortcut file. but when i select any shortcut file, it's going inside the shortcut file. not able to select the shortcut file.

for example: if you have shortcut file called "Shortcut of App". so if you select that, its showing the App folder and we need to select anything inside that. but not able to select the App.lnk.

if you have any idea how to do this, please help me and if you can provide an example, then that will be great help for me.

Thanks in Advance

remya1000 is offline
Reply With Quote
View Public Profile
 
Old 12-08-2008, 06:03 PM Re: Select Shortcut path in VB.NET
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
I'm not aware of anything else besides the filter property to change how the file browser deals with shortcut files. Probably that code is at a lower level than you have access to, so this path won't work for you.

If it was me, I'd make my own file browser. Add a new form to your project, and slap a ListBox and 2 Button controls onto it.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 12-09-2008, 02:21 PM Re: Select Shortcut path in VB.NET
Experienced Talker

Posts: 35
Name: remya
Trades: 0
Thank for you help Learning Newbie.

tried this code...
Code:
        OpenFileDialog1.Filter = "(*.LNK;*.EXE)|*.lnk;*.exe"
        OpenFileDialog1.DereferenceLinks = False
        OpenFileDialog1.ShowDialog()
so now it allow to select .exe or .lnk files. now i'm able to select .lnk files...

That worked... Once again thanks a lots for your help...
remya1000 is offline
Reply With Quote
View Public Profile
 
Old 12-09-2008, 02:34 PM Re: Select Shortcut path in VB.NET
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Sweet! Good find!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Select Shortcut path in VB.NET
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.57126 seconds with 12 queries