Step 1: Form
Drag and down a Button from tool box and give name it as Create File.

Step 2: Before creating a Text File.
Right click on Solution Explorer and click on "Open Folder in Window Explorer" Go to this path.
"WindowFormApplication2 -> Bin -> Debug"

Here you will see that there is not any Text File.
Step 3: Code

Double click on Button and write this code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Text;



nilam savaniPosted Sep 30, 2017, 2:18 AM
Hello Sir,I am doing the same thing. I want my service to automatically generate XML file and save it in folder. It is working proper in visual studio. But when I create setup file of it and install service in my system then nothing is working.