473,386 Members | 1,886 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,386 software developers and data experts.

How to select a drive?

How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.

-Harry
Nov 16 '05 #1
5 7882
Hi Harry,
How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.

-Harry


Drive list you can get by:
Directory.GetLogicalDrives

Directory.GetCurrentDirectory & Directory.SetCurrentDirectory
can be used to keep your drive.

Why do you want drive to write files instead of any directory path?

Marcin
Nov 16 '05 #2
Include your drive letter in your read or write operations that accept a
path.

xmlDS.WriteXml(path + "XmlDataSource.xml", XmlWriteMode.WriteSchema);

where path could be "d:\\yourPath\\yourDirectory\\subDirectory\\"

Let me know if this is what your looking for. If not please include your
code.
Phil
http://www.telysium.org
"Harry J. Smith" <hj*****@ix.netcom.com> wrote in message
news:9B******************@newsread2.news.pas.earth link.net...
How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.

-Harry

Nov 16 '05 #3

"Marcin Grzębski" <mg*******@void.taxussi.com.pl.void> wrote in message
news:c5***********@mamut1.aster.pl...
Hi Harry,
How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.

-Harry


Drive list you can get by:
Directory.GetLogicalDrives

Directory.GetCurrentDirectory & Directory.SetCurrentDirectory
can be used to keep your drive.

Why do you want drive to write files instead of any directory path?

Marcin


I am converting one of my programs from Visual Basic to C#, and I guess you
don't need to change drives before you write to a file be file name only,
just set the current directory.

-Harry
Nov 16 '05 #4
I am converting one of my programs from Visual Basic to C#, and I guess you
don't need to change drives before you write to a file be file name only,
just set the current directory.

-Harry

"sleepyinsomniac" <no@spam.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Include your drive letter in your read or write operations that accept a
path.

xmlDS.WriteXml(path + "XmlDataSource.xml", XmlWriteMode.WriteSchema);

where path could be "d:\\yourPath\\yourDirectory\\subDirectory\\"

Let me know if this is what your looking for. If not please include your
code.
Phil
http://www.telysium.org
"Harry J. Smith" <hj*****@ix.netcom.com> wrote in message
news:9B******************@newsread2.news.pas.earth link.net...
How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.

-Harry


Nov 16 '05 #5
> > How do you select a drive to write a file to?
In Visual Basic it is

ChDrive("D")

where D is the new drive letter. How do you do it in C#?

I could not find it in the msdn Library or at the Visual C# .NET Support
Center.


In case anyone wonders how the question came up, this is actually an echo of
DOS 1.0 and 1.1. Before DOS 2.0 (1983), there were no subdirectories and
instead of selecting a current directory, all you could do was select drive
A or B (first or second diskette). (No hard disks in those days either.)

Nowadays you can still select current disk, and there is (at all times) a
current directory selected on each disk. So your complete current directory
at any given time = the current disk + the selected directory on that disk.

Nowadays some files are on a network path (such as \\blah\blither) and not a
drive letter at all.
Nov 16 '05 #6

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

Similar topics

4
by: Denis St-Michel | last post by:
Hello All, Hope some Guru will be able to help me with this. Let's take this example table A ------------------------------------------------------------------------------- id | ...
1
by: fig000 | last post by:
Hi, I want to use a select object in asp and have the user pick something from this select and have javascript open a window fired by an event. Once the new window is open it displays another...
10
by: MLH | last post by:
Suppose the following... Dim A as Date A=#7/24/2005# I wish to compare value of A against 2 other values: 1) 8/1/2005 2) 9/1/2005 Which is better and why... First:
3
by: Marcia Hon | last post by:
Hi, I am trying to use the select() socket programming command to select between stdin and a connection. Currently, I have a listening stream and stdin that I insert into the fd_set. The problem...
2
by: Kavitha | last post by:
Hi , Can any one tel me how to create a virtual drive in C#( similar to Gmail Virtual drive).Also tell me what interfaces could be used to create the same. Thanks in Advance Kavitha
4
by: CosminB [BRT] | last post by:
Hi, How can this be done? I've searched the internet for a solution to this problem, and can't find a clear answer. I need to be able to browse a remote computer's filesystem, using a certain...
4
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"...
0
by: Bhagya | last post by:
Hello All, I want to select a drive or a folder using the FileUpload Wizard...can i do this?? If not how to select the destination drive or folder?? Regards, Bhagya
23
by: Rotsey | last post by:
Hi, I am writing an app that scans hard drives and logs info about every fine on the drive. The first iteration of my code used a class and a generic list to store the data and rhis took...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.