Blog

Add Text File in Resource and Access it in Windows Form Application

Posted by Yogesh Sharma Blogs | Visual Studio 2010 Oct 03, 2012
In this code add a text file to Resource then we show this text file any where without externally copy this text file.

In this code add a text file to Resource then we show this text file in any where without externally copy this text file. 

private void button1_Click(object sender, EventArgs e)
{
    char[] byteArray = new char[showHelp.Properties.Resources.build_relation.Length];
    showHelp.Properties.Resources.build_relation.CopyTo(0,byteArray, 0,byteArray.Count());
    string tmpPath= Path.GetTempPath();
    StreamWriter sw = new StreamWriter(tmpPath + "\\help.txt");
    sw.Write(byteArray);
    sw.Close();
    System.Diagnostics.Process.Start(tmpPath + "\\help.txt");
}

COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.