Super Basic menu program

pts.
Tags:
VB.NET
VBA
VBScript
Visual Basic
I haven't used VB in forever but I'm trying to create a simple program. I'm going to run program along with a couple of other files on a CD. I've created two buttons, the 1st to open a file and the 2nd to open a different open. I'm using a call shell command but if the cd rom drive letter is different from d: it will error out. What are my options???

Answer Wiki

Thanks. We'll let you know when a new response is added.

you should find the cd drive letter using vb as shown in the following article

http://www.brettb.com/VBScriptDrivesCollection.asp

and then use that letter in your program instead of hardcoding as d:

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WalterP
    Use the Windows API to get the CD Drive letter. Cheers,
    0 pointsBadges:
    report
  • WalterP
    Further to my suggestion to use the Win API, here is some sample code: http://support.microsoft.com/kb/q180766/ Cheers.
    0 pointsBadges:
    report
  • Cgoady
    Ok, I'm going to really show my ignorance, but what command am I going to use select the cd rom drive it and run the file i need i.e (call shell %CDROM_DRIVE%":test.txt")
    0 pointsBadges:
    report
  • Mcp111
    Let's assume you found the cd-rom drive letter using a VBA program shown in this link http://support.microsoft.com/kb/q180766/ The variable strDriveletter now contains the drive letter. Then you would write shell("c:windowsnotepad.exe " + strdriveletter + ":test.txt) to open the test.txt in notepad.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following