[Solved] I am making a visual C# winform application. I want to store data in it [closed]


To create files, you will be using the System.IO.File namespace. This gives you access to methods such as Create(), CreateText(), WriteAllBytes(). Which method you use will depend on what type of data you are using.

To save the file in your application directory, you can get the path using AppDomain.BaseDirectory

So for example if you’re storing plain text, you could do something similar to

public static void WriteSomeText(string text) 
{
    string path = Path.Combine(AppDomain.BaseDirectory, "mytextfile.txt");
    using (StreamWriter sw = File.CreateText(path)) 
    {
        sw.WriteLine(text);
    }
}

1

solved I am making a visual C# winform application. I want to store data in it [closed]