Standalon Win app - best method for saving / loading data?

  • 13 years ago

    Hi,

    I'm a beginner VB.NET developer so please bear with me, any help would be much appreciated!

    I'm developing a standalone application for Windows based on simple report generating. It'll just be a series of user-input text boxes and tickboxes that, when they've finished, will output to an .rtf they can print out. The issue I'm currently dealing with is that I want a save / load function for all the data the user has input. I've got the usual array of beginner books but none seem to give a decent example of how to do this! Can anyone give some ideas of what methods I should be looking at?

    Thanks!

  • 13 years ago

    Depending on the complexity and amount of data you want to store, some methods come to my mind:

    1.) If the amount of data is little, you can use the registry. Please have a look at the class 'Microsoft.Win32.Registry'.

    2.) If you need to store more data, you can use a text file. Please have a look at the namespace 'System.IO'. The classes 'StreamReader' and 'StreamWriter' (maybe 'File', too) may be interesting. If the user should be able to select the path for this file, please try System.Windows.Forms.OpenFileDialog' and 'System.Windows.Forms.SaveFileDialog'. If the user should not be allowed to select the file's location, you can use your applications folder 'System.Configuration.ExeContext.ExePath'.

    3.) If the data you want to store is getting more complex, you can try a XML file. --> 'System.XML'.

    4.) In some special cases it may also be worth to write the data into an Excel file or an Access / SQL database.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.”