problem writing to a file

View: New views
1 Messages — Rating Filter:   Alert me  

problem writing to a file

by conshl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using the following code but when the button is clicked, the contents of entry1 are not being written to IPAddresses.txt.  Any help would be much appreciated


        protected virtual void OnButton1Clicked (object sender, System.EventArgs e)

                {

                System.IO.StreamWriter StreamWriter1 = new System.IO.StreamWriter("IPAddresses.txt");

                StreamWriter1.WriteLine(entry1.Text);

                StreamWriter1.Close();

                }