hello there! Im having a strange problem with saving files. im trying to use saveToolStripMenuItem and saveFileDialog to save an array of strings into a text file. when i debug the program everything's fine but the save option doesnt work. i mean whenever i click on "save" nothing happens. to be precise im pasting my code here.
if i open up a new project and paste this code it works but when im trying to implement that same thing in this current project its not working. one more thing i have done this thing before with this project and it worked.but after restarting visual c# its not working. please help meCode:private void saveToolStripMenuItem_Click(object sender, EventArgs e) { string saved_file = ""; saveFileDialog1.FileName = ""; saveFileDialog1.ShowDialog(); if (saveFileDialog1.ShowDialog() != DialogResult.Cancel) { saved_file = saveFileDialog1.FileName; string[] tarray = new string[4]; tarray[0] = "Name: " ; tarray[1] = "Account no: " ; tarray[2] = "Balance: " ; tarray[3] = "Contact: " ; File.WriteAllLines(saved_file, tarray); } }
thanks in advance
lamiajoyee




Reply With Quote
