how to open a file and save file at the runtime

First of all you have to  do following things:
1.You have to goto to the Add References under the Project then click on the  Microsoft.VisualBasic.
2.Then you have to add a button on a form and openFileDialog and saveFileDialog in a form
3.You have to add a namespace using Microsoft.VisualBasic;
 
then you have to write these code in button click function.


private void button5_Click(object sender, EventArgs e)
        {
               String str_open=null;
String str_save=null;
int CA=0,DLT=0,M=0,SUM=0;
    openFileDialog1.Filter = "Textfile(*.txt)|*.txt|ALL FILE(*.*)|*.*"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { str_open = openFileDialog1.FileName; }
FileSystem.FileOpen(1, str_open, OpenMode.Input, OpenAccess.Read, OpenShare.Shared, 50);
saveFileDialog1.Filter = "Textfile(*.txt)|*.txt|ALL FILE(*.*)|*.*"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { str_save = saveFileDialog1.FileName; }
FileSystem.FileOpen(2, str_save, OpenMode.Output, OpenAccess.Write, OpenShare.Shared, 50);
FileSystem.Input(1, ref M); CA = (int)M; FileSystem.Input(1, ref M); DLT = (int)M;
SUM=CA+DLT;
FileSystem.Print(2,SUM);
FileSystem.FileClose(1);
FileSystem.FileClose(2);
}

Input file must contain two int value.