Answers for "c# load embedded html document and show in browser"

0

c# load embedded html document and show in browser

1. Add HTML Page from C3 Add New Item
2. Put html inside
3. Drag and drop the html (e.g. HTMLPage1.html) file into your Resources tab in the project:
4. Use code below 
        private void button1_Click_1(object sender, EventArgs e)
        {
            string html = Properties.Resources.HTMLPage1;
            string tmpFileName = Path.ChangeExtension(Path.GetTempFileName(), ".html");
            using (StreamWriter sw = File.CreateText(tmpFileName))
            {             
                sw.Write(html);
                sw.Flush();
            }
            if (File.Exists(tmpFileName))
                Process.Start(tmpFileName);
        }
Posted by: Guest on June-09-2021

Browse Popular Code Answers by Language