Created
July 11, 2014 02:57
-
-
Save matutter/81c53c06ac4eb5a00d23 to your computer and use it in GitHub Desktop.
persistence is very easy in c#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel; | |
| using System.Data; | |
| using System.Drawing; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Windows.Forms; | |
| namespace settings | |
| { | |
| public partial class Form1 : Form | |
| { | |
| private string variable = "..."; | |
| public Form1() | |
| { | |
| InitializeComponent(); | |
| label1.Text = variable = Properties.Settings.Default["variable1"].ToString() ; | |
| } | |
| private void button1_Click(object sender, EventArgs e) | |
| { | |
| variable = textBox1.Text; | |
| updateText(); | |
| Properties.Settings.Default["variable1"] = variable; | |
| Properties.Settings.Default.Save(); | |
| } | |
| private void updateText() | |
| { | |
| label1.Text = variable; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment