473,563 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to open files only in drive "e:\"

excuse me, may i ask on how to open files only in drive "e:\" (which is my
usb port for flash drives) using openfiledialog? because in the
openfiledialog, even when i set my initialdirector y to drive "e:\", people
can still browse other drives(drive c, d, etc. )

so for example, when they insert their flash drives, then they open the
openfiledialog, how can i make an error trap on how to let them open files
only in their flash drives which is drive "e:\"? and when they try to open
files from drive c or other drives, a msgbox will appear like "sorry, you can
open files only in drive e".

can anyone post a code for this? thanks!!

--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...b-net/200801/1

Jan 12 '08 #1
4 4230
"jabslim via DotNetMonster.c om" <u40064@uwewrot e in
news:7e1b0c5ee7 844@uwe:
so for example, when they insert their flash drives, then they open
the openfiledialog, how can i make an error trap on how to let them
open files only in their flash drives which is drive "e:\"? and when
they try to open files from drive c or other drives, a msgbox will
appear like "sorry, you can open files only in drive e".

can anyone post a code for this? thanks!!
I don't think this is possible with the standard open file dialog box...
you'll need to create your own dialog box which shouldn't be too hard to
do.

--
sp**********@ro gers.com (Do not e-mail)
Jan 12 '08 #2
On Jan 12, 6:17 pm, "jabslim via DotNetMonster.c om" <u40064@uwe>
wrote:
excuse me, may i ask on how to open files only in drive "e:\" (which is my
usb port for flash drives) using openfiledialog? because in the
openfiledialog, even when i set my initialdirector y to drive "e:\", people
can still browse other drives(drive c, d, etc. )

so for example, when they insert their flash drives, then they open the
openfiledialog, how can i make an error trap on how to let them open files
only in their flash drives which is drive "e:\"? and when they try to open
files from drive c or other drives, a msgbox will appear like "sorry, you can
open files only in drive e".

can anyone post a code for this? thanks!!

--
Message posted via DotNetMonster.c omhttp://www.dotnetmonst er.com/Uwe/Forums.aspx/dotnet-vb-net/200801/1
Maybe you can disallow users after selecting file with that code:

If OpenFileDialog1 .ShowDialog = Windows.Forms.D ialogResult.OK Then
If OpenFileDialog1 .FileName.Start sWith("E:\") = False Then
MsgBox("Nope")
Else
'Do what you want
End If
End If
Hope this helps
Jan 12 '08 #3
Hi,

It's possible using Dialog Workshop.NET dialog components.
Special CaOpenFileDialo g component replaces OpenFileDialog component and
allows you to restrict folder change in open/save dialogs. It's possible if
you add just two event handlers. See RestrictingFold erchange sample provided
in the Dialog Workshop.NET evaluation package. Also many other powerful
features are available ("docking" your own WinForm to the dialog window,
etc.).

Please visit http://www.componentage.com for details.

Hope it helps.
Alex Petrov

"jabslim via DotNetMonster.c om" <u40064@uweсо общил/сообщил в новостя
следующ е: news:7e1b0c5ee7 844@uwe...
excuse me, may i ask on how to open files only in drive "e:\" (which is my
usb port for flash drives) using openfiledialog? because in the
openfiledialog, even when i set my initialdirector y to drive "e:\", people
can still browse other drives(drive c, d, etc. )

so for example, when they insert their flash drives, then they open the
openfiledialog, how can i make an error trap on how to let them open files
only in their flash drives which is drive "e:\"? and when they try to open
files from drive c or other drives, a msgbox will appear like "sorry, you
can
open files only in drive e".

can anyone post a code for this? thanks!!

--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...b-net/200801/1
Jan 12 '08 #4
thanks for your help guys! i got the info i wanted!!

kimiraikkonen wrote:
>On Jan 12, 6:17 pm, "jabslim via DotNetMonster.c om" <u40064@uwe>
wrote:
>excuse me, may i ask on how to open files only in drive "e:\" (which is my
usb port for flash drives) using openfiledialog? because in the
[quoted text clipped - 11 lines]
>--
Message posted via DotNetMonster.c omhttp://www.dotnetmonst er.com/Uwe/Forums.aspx/dotnet-vb-net/200801/1

Maybe you can disallow users after selecting file with that code:

If OpenFileDialog1 .ShowDialog = Windows.Forms.D ialogResult.OK Then
If OpenFileDialog1 .FileName.Start sWith("E:\") = False Then
MsgBox("Nope")
Else
'Do what you want
End If
End If

Hope this helps
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...b-net/200801/1

Jan 13 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2235
by: Morten Overgaard | last post by:
Hi all Is it possible for a .Net app. to intercept the "open" action on files in a given directory. I want to intercept the "open" action and the perhaps direct the client ( the app. which is trying to open the file ) to another file - or stream another file back to the client in someway??? Any help is appreciated Regards Morten
0
1917
by: Michael | last post by:
I have a problem forcing files to download. If I select Save the document is saved with no problems. If I select "Open" the document is empty or I get a "File not found" error from the application opening the file... Code: function UTIL_ForceDownloadFile(strFileName, strFileSaveName) Response.Buffer = True Dim strFileSize Const...
1
2109
by: clusardi2k | last post by:
Hello, I have a shared drive on SGI, Linux, and Windows. The fact that I'm using a shared drive may be mute information. The problem is within the same program a second call to fopen does not create a file if the file has been deleted. I would like to use fopen for its pointer return value to solve this.
7
3361
by: clusardi2k | last post by:
Hello, I have a shared drive on SGI, Linux, and Windows. A second call to fopen doesn't create the file if it has been deleted. I would like to use fopen for its pointer return value to solve this. What is the best way to fix this problem?
3
1761
by: Just Me | last post by:
In code I check to see if the Floppy drive is ready and display it's state. But if the user inserts or removes a floppy disk I need an event or a Wndproc message to cause the code to display the new state. Is the some way the code can be alerted to the fact that a removable disk drive's state changed? I wonder if the above isn't clear.
2
4391
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take that extension and use that as my filter criteria for the File Open dialog. Once the user selects a file with that extension (from the File Open...
2
2042
by: Ralf Kaiser | last post by:
Hi, is it possible to define another place where the "Temporary ASP.NET Files" are stored? I do not want to have them on my system partition because i have a separate partition for all the temporary stuff on a separate physical drive. Is there a registry entry that defines the place for that folder?
7
8513
by: pike | last post by:
db2 8.1 FP11 on AIX 5.3.0.0 . The db2diag.log is intermittently reporting EMFILE (24) "Too many open files" errors. The culprit is always db2hmon. Sample db2diag.log output follows: 2007-03-20-07.42.35.269106+060 I14996239C505 LEVEL: Severe (OS) PID : 2289758 TID : 772 PROC : db2hmon 0 INSTANCE: defser_t ...
4
9127
by: Luc The Perverse | last post by:
Hi - I have very little C# programming experience. I am making a software product which calls for an interface almost identical to Windows Explorer - and I wondered if mounting a "virtual drive" would be feasable for me (someone not good at programming) to implement. -- LTP :)
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.