3
Answers

textwriter

nishant ranjan

nishant ranjan

11y
866
1
i have created a folder named xml. what i want to do is to create a test.xml file and write all data in stringbuilder sb to that test.xml file.
i am able to create the test.xml file at desired location but unable to write the value from sb to that file. below is my code


string filepath = Application.StartupPath;
            filepath = filepath.Replace("\\bin\\Debug", "\\xml\\");
         
            TextWriter tx = File.CreateText(filepath+"test.xml");
            tx.Write(sb.ToString());   // sb is stringbuilder whic contain data


Answers (3)