File reading/writing

I have created an application which uses XML files to populate a DataSet and then a DataGrid control. I've created a class which performs data reading and writing for me.

I want to let the user choose where to save the XML files. I have a vague idea of how to do this but I am unsure how to record the location of where the user has saved the files so that I can read from them again. Does anyone have any ideas as to what I could do? Also how do I bring up the dialog which allows the user to save the files?

Many thanks.



  • Hi,

    You can use OpenFileDialog and SaveFileDialog controls to Open and Save the Files respectively. You can also set the Filters for what ever files you want to Open.

    I hope this will help you solve your problem.

    OpenFileDailog classes object is opFileDialog then

    opFileDialog.ShowDialog() will display the dialog box to the user.
    opFileDialog.FileName give the name of the file you have selected for opening.

    similarly the case with the SaveFileDialog.

    All the best

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion