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");
}

post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.