Hello everyone, I'm having a problem of creating a program that provides a functionality of creating its own file, saving its own file, and reopening its own file just like the functionality of the other windows application like MSWord, MSExcel, etc.,

Please everyone, I really need to know about it... I know that programming languages have this kind of capabilities but I don't know where to find it, please everyone...:?:

It may not be very efficient, but this creates an output file with the one string in it:

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FileCreationTesting
{
    class Program
    {
        static void Main(string[] args)
        {
            String test = "This is some sample data\n";
            FileStream fh = File.OpenWrite("targetfile.txt");
            fh.Write(Encoding.ASCII.GetBytes(test), 0, Encoding.ASCII.GetByteCount(test));
            fh.Close();
        }
    }
}

FileStream fs = File.Create(@"C:\MyFiles\Test.txt"); will create a file Test.txt in the directory MyFiles on the C-drive.

Following C# program can create the text file on d drive. You can change the path of file to be created.
using System;
using System.IO;


class CreateNewFile
{
static void Main(string[] args)
{


TextWriter tw = new StreamWriter("d:\\NewFile.txt");


tw.WriteLine("This is new file i have created");
tw.WriteLine(DateTime.Now);


tw.Close();
}
}

---------------------------------------------------------------------------
GeorgeRxz
<SNIP>

Use OpenFileDialog

Use OpenFileDialog

IMHO you can create a folder a map a directory with OpenFileDialog, but no file...

you can

Thank you very much everyone!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.