c# - Save user input -
this question has answer here:
- best way save per user options in c# 5 answers
so basically, have openfiledialog working displays chosen dir in textbox. i'm wondering how save users input when restart application stay in textbox? wouldn't have on every time. understand might stupid question, i've been googeling time , found nothing this. thanks.
public form1() { initializecomponent(); if(file.exists(@"path.txt")) textbox1.text = file.readalltext(@"path.txt"); } private void button1_click(object sender, eventargs e) { if(file.exists(@"path.txt") == false) file.create(@"path.txt"); file.writealltext(@"path.txt", textbox1.text); }
just write in file, don't forget include system.io in references.
Comments
Post a Comment