I created simple program in C# (windowsForms) for save/open practice using VS2013.I made a setup and associated my program with my own datatype, called it .xxx (for practice).
I managed to Save and Open code and data from textbox but only from my program (in program i go Open and navigate to saved file). 
But when i double click (or enter from windows-desktop), it open up my WindowsForm as it is but there is an empty textbox (saved UI was not restored). I want my saved file to be opened on double click in the same condition as when I open it from my program. How to set that up??

Here is the code of simple app with image

private void ButOpen_Click(object sender, EventArgs e)
           textBox1.Text = "";
           DialogResult result = openFileDialog1.ShowDialog();
           if (result == DialogResult.OK)
               string data = Read(openFileDialog1.FileName);
               textBox1.Text = data;
           {//do nothing }    
private string Read(string file)

           StreamReader reader = new StreamReader(file);
           string data = reader.ReadToEnd();

           return data;
private void ButSave_Click(object sender, EventArgs e)
           SaveFileDialog saveFileDialog1 = new SaveFileDialog();
           saveFileDialog1.Filter = "Something|*.xxx";

           DialogResult result = saveFileDialog1.ShowDialog();

           string file = saveFileDialog1.FileName.ToString();
           string data = textBox1.Text;
           Save(file, data);
private void Save(string file, string data)
           StreamWriter writer = new StreamWriter(file);

WindowsForm for practice


Maby the problem is with OS - i am using w7. Just wanted to find out how to configure registry (if that is the problem) so windows understand and load data inside the file, or to file save data somehow so i can open it with double click.
This is my registry now (i think everything is ok with it):

in HKEY_CLASSES_ROOT i have my extension defined as .xxx (Data is Something) - Something (Value not set) - ShellNew (Value not set)
Also i have data for Something - shell (open) - open (&open) - command (and my command default data value is: "C:\Program Files (x86)\Tryout\TestProgram.exe" "%1""

Someone please help. If something is not clear I will give detailed information just ask on what point.
I am a beginner so if I am missing a command I dont know which and how should it be used..