private void button3_Click(object sender, EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "Open Map File"; fdlg.Filter = "Text Files|*.doc;*.docx;*.txt;*.text"; if (fdlg.ShowDialog() == DialogResult.OK) { textBox5.Text = fdlg.FileName; } GetinfoFromMapFile(); textBox11.Clear(); textBox6.Clear(); textBox10.Clear(); count++; Fname = null; Fname = "Output"; Fname += count; Fname += ".txt"; FileStream FF; if (File.Exists(Fname)) { FF = new FileStream(Fname, FileMode.Truncate); } else { FF = new FileStream(Fname, FileMode.Create); } FF.Close(); }