473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Checking the presence of a disc in the drive

vdraceil
236 100+
Hi friends,i just wanna know whether the presence of a disc in the drive can be detected by coding in vb6.0..if the disc is present i want to perform a set of actions, else i want to display 'insert disc please'..Experts kindly help
Dec 16 '07 #1
2 1808
daniel aristidou
491 256MB
Hi friends,i just wanna know whether the presence of a disc in the drive can be detected by coding in vb6.0..if the disc is present i want to perform a set of actions, else i want to display 'insert disc please'..Experts kindly help
Hi ... sorry it took a long time but here is the code i belive will work.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim Drive As String
  3. Drive = "D:\"
  4. Dim Rename As String
  5. Rename = FileSystem.Dir(Drive, vbVolume)
  6.  
  7. If Len(Rename) = 0 Then
  8.     If MsgBox("There is no Disk Present", vbCritical + vbRetryCancel) = vbRetry Then
  9.         Command1_Click
  10.     End If
  11. Else
  12. MsgBox (Rename & " Is in the Drive")
  13. End If
  14.  
  15. End Sub
Jan 4 '08 #2
Killer42
8,435 Expert 8TB
There's another alternative. Add a reference to Microsoft Scripting Runtime to your project. And add a command button, of course. Then try this...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   Dim fso As New FileSystemObject
  3.   Dim drv As Drive
  4.   For Each drv In fso.Drives
  5.       Me.Print drv.DriveLetter, drv.DriveType, drv.IsReady
  6.     End With
  7.   Next
  8. End Sub
Jan 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: YT | last post by:
Hello, I am this close | | to throwing myself out the window... I am trying to do a <UL><LI> series and i really really really want the disc size of the list to be nice and small. i've been...
2
by: John Baker | last post by:
Hi: I have an Access application that has been running on my desktop system just fine. I recently tried to move it to my laptop, and on the laptop I get a "Disc or Network Error" message when I...
2
by: Rob | last post by:
Does anyone have any idea of any API that exists, or functions that others have created to find out the start cluster address of any particular file on a FAT32 formatted disc. I dont mind using...
0
by: Johnny Jörgensen | last post by:
Does anybody know how to tell what type of disc that's in the drive currently? I need to be able to distinguish between CD's containing data and Audio CD's Cheers, Johnny J.
2
by: aviraldg | last post by:
Well , could someone tell me how to read/write to a disc drive ? And by disc drive , I mean *disc*drive* , not the files on it. I'm using VC++ 6 , and would prefer the easiest method , even if it...
2
by: joer.banno | last post by:
Hi, In a webapp I'm writing I need to know if another webapp is running (both of which are asp.net), is there a way that you can check for the presence of another webapp? The problem is that...
0
by: =?Utf-8?B?TWFubnk=?= | last post by:
When no disc is in the drive it shows to be a DVD-RW drive but I place a blank DVD-R or Blank DVD+R in the drive is show that a blank CD has been inserted. -- Manny
1
by: =?Utf-8?B?T2FrZGVuZQ==?= | last post by:
I've just bought a new computer and want to load my Office software onto it. The software is on a disc, but the computer doesn't have a disc drive. I've tried loading the disc onto a flash drive...
1
by: =?Utf-8?B?amlt?= | last post by:
Using the normal method my disc check and defragmenter will not work on c drive
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.