How can I save the userInput in Windows Form

0

I would like to know what is the best way to save the information that a user enters in different textBox in a Windows Form application.

I have read several forums recommending to save the whole in an XML file.

What I'm looking to do is every time the application starts, it can remember what information was entered the previous time the application was executed.

What is the best way to do this?

Thank you very much in advance.

    
asked by A arancibia 08.04.2016 в 18:47
source

2 answers

1

If they are very simple data you do not need a database or an xml, you can do that with a settings file in the project, either user or application.

link

link

Greetings.

    
answered by 10.04.2016 в 07:53
0

If you persist in a db Sql Compact you do not need any database engine in the client

SQL Server Compact / SQLite Toolbox

Use SQL Server Compact (Visual Studio)

You add the db as an item in the project

And programs like any other database use the ado.net class

DataTable dt = new DataTable();   
using (SqlCeConnection conn = new SqlCeConnection("connection string"))   
{   
    string query = "select id, desc from <tabla>";   

    SqlCeCommand cmd = new SqlCeCommand(query, conn);   

    SqlDataAdapter da = new SqlDataAdapter(cmd);     
    da.Fill(dt);   
}

In this case you use the classes with SqlCe prefix using the classes of System.Data.SqlServerCe Namespace

    
answered by 08.04.2016 в 20:35