none
Internal Application Files.

    Question

  • Hello C shapers,
    I am working on a application where a user is able to change the label of a button and it save to a file so they can edit it whenever they choose to do so. I need a internal file system or something close to it. 

    On start up I have a textbox and two buttons. User enters text then hits the save button and it changes the label of the other button.

    System.IO.File, is what I am use to read/write. Works as need for the moment. Below is button_click event.

    button2.Text = textBox1.Text;
                string s1 = button2.Text;
                string s2 = s1;
                System.IO.File.WriteAllText(@"C:\Users\Nixx\Documents\Visual Studio 2015\Projects\simple test\simple test\TextFile3.txt", s2);


    I have something like this is the start of the form but i need a better idea on how to save the strings internally.

    To note I do have understanding of programming basics based on c++ but am new to visual studio and C#..

    Thank you for reading...

    Nick-


    • Moved by Sara Liu Friday, April 21, 2017 2:56 AM
    Thursday, April 20, 2017 1:44 AM

All replies

  • Hi Nick,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the C# development. Since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum to seek for a more professional support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 21, 2017 2:55 AM
  • If the set of data is limited then look into using ApplicationSettings that are user scoped. You'll be responsible for loading the data when the app starts and saving it when it changes.

    If this is part of a larger set of data you're storing (similar to a form editor) then you can store this data as part of that instead. You'll still be responsible for loading the correct values when the form loads.

    Michael Taylor
    http://www.michaeltaylorp3.net

    • Proposed as answer by Chad333 Friday, April 21, 2017 3:52 PM
    Friday, April 21, 2017 1:54 PM
    Moderator