how to save value of a c# variable to an external file?

Asked

Viewed 116 times

1

How can I save a variable to an external file? It was programmed in win Forms . Net Framework c#. For example:

In the following we have that whenever I press the ADD button to combobox, currently marked as "hi", will add as new item what is written in the textbox:

inserir a descrição da imagem aqui

private void add_Click(object sender, EventArgs e)
{
    list.Items.Add(name.Text);
}

I wanted to know how to save the name of all Items already contained in the list (place where it is written "hi"), so that when I opened the program for the second time, it remained with the last name I have already marked and all others still selectable.

Thus, if I closed the program in the following state (Image 2), I wanted that when I opened for the second time it would already be with the item "hi" marked, all other items still contained to be selected, and all the items that I added later were also saved.

inserir a descrição da imagem aqui

  • HI Octavian, what you are describing would be basically a database to store the typed texts and a cookie to open the form with the last typed text. That’s it?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.