OK i need to be able to let the user click a button to open a filedilag then the browse to theflie/folder they want and hit ok. that will the bring up another one asking where they want to put it.

bassically it asks a user whatfile they want and where to copy it to.


pls help

openFileDialog1.ShowDialog();
string fileToOpen = openFileDialog1.FileName;
saveFileDialog1.ShowDialog();
string whereToSave = saveFileDialog1.FileName;
openFileDialog1.ShowDialog();
string fileToOpen = openFileDialog1.FileName;
saveFileDialog1.ShowDialog();
string whereToSave = saveFileDialog1.FileName;

i want the whole folde not just one specific thing...that cant do it

folderBrowserDialog1.ShowDialog();
string folderOpen = folderBrowserDialog1.SelectedPath;
folderBrowserDialog1.ShowDialog();
string folderSave = folderBrowserDialog1.SelectedPath;

//then do the transfer or whatever

i tried this

folderBrowserDialog1.ShowDialog();
            string folderOpen = folderBrowserDialog1.SelectedPath;
            folderBrowserDialog2.ShowDialog();
            string folderSave = folderBrowserDialog2.SelectedPath;
            File.Copy(folderBrowserDialog1.SelectedPath, folderBrowserDialog2.SelectedPath);

and it gives me an error sayiing that it is a directory not file

i tried this

folderBrowserDialog1.ShowDialog();
            string folderOpen = folderBrowserDialog1.SelectedPath;
            folderBrowserDialog2.ShowDialog();
            string folderSave = folderBrowserDialog2.SelectedPath;
            File.Copy(folderBrowserDialog1.SelectedPath, folderBrowserDialog2.SelectedPath);

and it gives me an error sayiing that it is a directory not file

thats because that command is for copying files not directories, you should copy each file in the directory individualy

thats because that command is for copying files not directories, you should copy each file in the directory individualy

so u dont know of any code that will copy the directory

no but loop up how to list files in a directery, then just loop till you copied them all

Can some aspect of this concept also be applied to creating a new database file? For example, I'm developing a program that stores data in an Access database, and I'd like the user to be able to create/use multiple databases.

I've asked this question here before and got NADAfor an answer!

Can some aspect of this concept also be applied to creating a new database file? For example, I'm developing a program that stores data in an Access database, and I'd like the user to be able to create/use multiple databases.

I've asked this question here before and got NADAfor an answer!

the easiest way i think to do this is include an empty database in your project, then just copy it to wherever when you need a new one

i would like to know hot to let teh user decide what drive they want. i am developing aa program hat will rip teh music off an ipod. and as u may or may not no the ipod, depending on te computer changes drive letters. i would like to let the user choose. also i would like to have teh select rip music then the *.mp3 are ripped from the ipod control folder/music. How would i do this. Thanks

the easiest way i think to do this is include an empty database in your project, then just copy it to wherever when you need a new one

That's what I was thinking, but the problem (for me) is that if I want to allow the user to name the new database, wouldn't that affect my connection string? I thought about just allowing the user to create the new database by making a copy (as you suggest), but without naming it. The problem there is how to allow multiple databases to coexist.
I'm thinking there must be a way to have the program create a connection string to include the name and path the user chooses for the new database, I just don't know how to make that happen...yet.

That's what I was thinking, but the problem (for me) is that if I want to allow the user to name the new database, wouldn't that affect my connection string? I thought about just allowing the user to create the new database by making a copy (as you suggest), but without naming it. The problem there is how to allow multiple databases to coexist.
I'm thinking there must be a way to have the program create a connection string to include the name and path the user chooses for the new database, I just don't know how to make that happen...yet.

couldnt you just save the db name either in a file or saving it to a registry key and just read the names when the programs starts

I think that would work, but as far as having the connection string modified to connect to the new (or selected) database by that name, I don't know how to code. What I'm thinking is that I could use a variable in the connection string. Then, the path and filename of the new or selected database file could be put into that variable. This seems like the concept that would work, but I'm not sure how to turn that concept into actual code.

I think that would work, but as far as having the connection string modified to connect to the new (or selected) database by that name, I don't know how to code. What I'm thinking is that I could use a variable in the connection string. Then, the path and filename of the new or selected database file could be put into that variable. This seems like the concept that would work, but I'm not sure how to turn that concept into actual code.

i posted how to do this once before but i dont see my post.
however i found a better way on msdn. do somethign similiar to this on your connection string:

String userid;
String password;
String connectionString;
connectionString = "data source=myserver";
connectionString += ";initial catalog=northwind";
connectionString += ";user id=" + userid;
connectionString += ";password=" + password;
sqlConnection1.ConnectionString = connectionString;

obviously its not sql but its made the same way
and basically it shows a way to insert variables easily into a connection string.

EDIT:
here is the site that i got this at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskaccessingsqlserverwithexplicitcredentials.asp

they show other ways to like getting info from registry to add to the string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.