C# Tutorial - How to save user settings

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 18

  • @tomd5678
    @tomd5678 4 ปีที่แล้ว +1

    //My notes after reading around this
    namespace setttingsettings
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    //Click "Load" after selecting "Events" in "Properties" in the solutions explorer
    private void Form1_Load_1(object sender, EventArgs e)
    {
    MessageBox.Show("load ", "load");
    GetSettings();
    }
    // Call this from "Form1_Load"
    public void GetSettings()
    {
    lblName.Text = Properties.Settings.Default.Name;
    lblTel.Text = Properties.Settings.Default.Tel.ToString();
    MessageBox.Show("Get ", "get");
    }
    //Highlight the Save button from the designer and then select the "Click" "Action" to make this function
    private void cmdSave_Click(object sender, EventArgs e)
    {
    SaveSettings();
    }
    public void SaveSettings()
    {
    MessageBox.Show("SAVE ", "SAVE");
    Properties.Settings.Default.Name = txtName.Text;
    Properties.Settings.Default.Tel = Convert.ToInt32(txtTel.Text);
    Properties.Settings.Default.Save();
    lblName.Text = Properties.Settings.Default.Name;
    lblTel.Text = Properties.Settings.Default.Tel.ToString();
    }

  • @ronapseex3428
    @ronapseex3428 4 ปีที่แล้ว

    helpful but 1 problem
    if you shut down the PC, or restart it, it wont save.

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      You should save before shut down your pc

    • @ronapseex3428
      @ronapseex3428 4 ปีที่แล้ว

      ok thanks!

  • @foxlearn
    @foxlearn  9 ปีที่แล้ว +2

    How to save user settings

  • @llibkram5007
    @llibkram5007 5 ปีที่แล้ว

    how to add setting in Runtime .? like Settings.default.add("New Setting").?

  • @mohamedkhalifa2009
    @mohamedkhalifa2009 7 ปีที่แล้ว +1

    good job .... but how to save settings into App.Config . can you do this

    • @foxlearn
      @foxlearn  7 ปีที่แล้ว

      Hi, You can view this video th-cam.com/video/-KdqdWTNO7Q/w-d-xo.html to know how to save settings to the app.config file. thank you

  • @aryanbhaskar7872
    @aryanbhaskar7872 4 ปีที่แล้ว

    I have been watchingyou for a long time.Sir is there any way to save image in settings pannel. Like text feed . without creating a database
    Plzzz help me i am stuck.

  • @williamprogramer4168
    @williamprogramer4168 4 ปีที่แล้ว

    it makes me an error on the way in

    • @hoooklook
      @hoooklook 4 ปีที่แล้ว

      My question too

  • @shafiullahnabavi9081
    @shafiullahnabavi9081 8 ปีที่แล้ว

    Hi How to save ListBox and ComboBox items

    • @foxlearn
      @foxlearn  8 ปีที่แล้ว

      Hi, You can save data as a string for example [item1, item2, item3], then use split method to convert to array. Thanks

    • @alitauseef9423
      @alitauseef9423 6 ปีที่แล้ว

      can you make a tutorial on that please??

  • @sunilranasingha7546
    @sunilranasingha7546 4 ปีที่แล้ว

    Thankz

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      Thank you !

  • @rebin_daho22
    @rebin_daho22 4 ปีที่แล้ว

    Thanks for foxlearn