mardi 14 février 2017

application setting doesn't work well (c#)

I have a checkbox(Name:tarahi_algouritm) and a button(Name:button1) on my form(Name:frm_choose).I want to save the latest changes on my checkbox as user clicked on the button.it means user run the program and check the checkbox and then click on button and then close the program.when he/she Rerun it,checkbox should be checked.or someway he disable the checkbox and click on button and after another run,checkbox should be disabled.for this, in application setting(table part) put a checkbox (Name:s_tarahi_algouritm)and choose USER in scope part..as I said changes are apply on checkbox and s_tarahi_algouritm is used for save the latest changes on checkbox.I wrote these codes:

private void frm_choose_Load(object sender, EventArgs e)
    {
        if (Properties.Settings.Default.s_tarahi_algouritm!=null)
          tarahi_algouritm= Properties.Settings.Default.s_tarahi_algouritm;

    }

private void button1_Click(object sender, EventArgs e)
    {
        Properties.Settings.Default.s_tarahi_algouritm = tarahi_algouritm;
         Properties.Settings.Default.Save();
    }

but When I make changes on checkbox and close the debug and Rerun it,changes are not applied. what should I do?where is wrong?I am partly beginner so explain explicit. thank you all




Aucun commentaire:

Enregistrer un commentaire