-
July 27th, 2011, 04:33 AM
#1
Error Message
Hi,
I have a button click on my form, when I click it I receive the following error;
The folder Desktop cannot be used
Please Choose another folder
OK
When I click OK,
it opens My Documents, My computer then I can browse through the drives..
We have restriction in my work place and cant open the desktop, therefore, I wish to change the code to go straight to my computer where all the drives can be seen..
The code is:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim fbd As New FolderBrowserDialog
If fbd.ShowDialog = DialogResult.OK Then
Label2.Text = fbd.SelectedPath
End If
End Sub
Thanks
-
July 27th, 2011, 05:24 AM
#2
Re: Error Message
The problem here is that Desktop is a Valid directory "C:\users\{username}\Desktop" however 'My computer' is not a valid path, but simply a shortcut... What you could do is set it to goto "C:\"
Code:
fbd.SelectedPath = "C:\"
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
July 27th, 2011, 05:42 AM
#3
Re: Error Message
Changed the code to:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim fbd As New FolderBrowserDialog
fbd.SelectedPath = "C:\Documents amd Settings\AbdallahR\Application\"
If fbd.ShowDialog = DialogResult.OK Then
Label2.Text = fbd.SelectedPath
End If
End Sub
Still received the same error..
-
July 27th, 2011, 08:30 AM
#4
Re: Error Message
Originally Posted by dr223
Changed the code to: "C:\Documents amd Settings\AbdallahR\Application\"
Still received the same error..
I suggested that::
Originally Posted by GremlinSA
What you could do is set it to goto "C:\"
BECAUSE::
Originally Posted by dr223
We have restriction in my work place and cant open the desktop, therefore, I wish to change the code to go straight to my computer where all the drives can be seen..
and then also it's
Documents and Settings not 'Documents amd Settings'
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
July 27th, 2011, 08:52 AM
#5
Re: Error Message
You can set the RootFolder instead which will give you your starting point when opened.
for example to start in my documents
Code:
FB1.RootFolder = Environment.SpecialFolder.MyDocuments
The advantage here is that this will work on XP, Vista and Windows 7 even though the my documents folder is in a different location.
Always use [code][/code] tags when posting code.
-
July 27th, 2011, 11:34 AM
#6
Re: Error Message
Code:
We have restriction in my work place and cant open the desktop,
That would be a Network Administration problem... Contact System Administrator...
It's probably a ROAMING profile on the server... Can you see your desktop on ANY pc? Then it is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|