Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 22-01-2007, 10:13 AM   #1 (permalink)
Right Off the Assembly Line
 
amandeep2707's Avatar
 
Join Date: Dec 2006
Location: Jallandhar
Posts: 6
Lightbulb visual basic small but big problem


i have visual studio 6.
i designed a program to browse drives.

here's the problem:
the drive list box shows all drives(including cd drives and floppy drive). but if i try to access a floppy drive or a cd drive in which no media is present, then i get an error message saying that
the given device is unavailable and the program shuts down. how do i bypass this so that this error does not occur(or displays a message in a message box) and the program also does not shut down??

please help
__________________
I miss Ferozepur a lot.
amandeep2707 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 22-01-2007, 11:05 AM   #2 (permalink)
Old Stock in New Bottle!!
 
Digit_Dragon's Avatar
 
Join Date: Jan 2007
Posts: 62
Default visual basic small but big problem

The program shuts down, may be for the the reason, if one attempts to access the property without sufficient permission that throws a SecurityException.
Digit_Dragon is offline  
Old 22-01-2007, 11:16 AM   #3 (permalink)
Alpha Geek
 
Join Date: Jan 2007
Location: In your hearts
Posts: 828
Thumbs up Re: visual basic small but big problem

This is because no media is present. You can change this error to display a message box. You can download this Accessdrive.zip and extract it to any location say C:\accessdrive. It will have a .frm file run it you can get the code in drvDriveBox. Replace the errornumber with your own error number if needed and you can also change the Message.
Attached Files
File Type: zip Access drives.zip (782 Bytes, 0 views)
abhijangda is offline  
Old 22-01-2007, 11:48 AM   #4 (permalink)
In The Zone
 
plsoft's Avatar
 
Join Date: Mar 2005
Posts: 234
Default Re: visual basic small but big problem

If u face this problem only when there is no media then this code might help. Handle the errors by including the following code:
Private Sub...............
On Error GoTo drvError 'drvError or any error name you want
{statements}
{statements}
{statements}
drvError:
MsgBox "There is no media in the drive"
Exit Sub
End Sub

Hope this helps
plsoft is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by abhidev
- by Sarath
- by clmlbx
- by ico
- by clinton

Advertisement




All times are GMT +5.5. The time now is 02:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2