File reading/writing - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

File reading/writing

ITAITA Posts: 463Member
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.



  • koticsekoticse Posts: 17Member

    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.