Zebra won't print when I write filestream
<p>I am trying to print raw zpl data to a zebra printer using a byte array.  When I run the program nothing prints and the program passes through with no issue.  The only time it will actually print what I am asking for is if I step through and check my filestream values before I close it, the label will print. Can anyone help with what is causing this?</p>

<p>Update: Made suggested adjustments to code and this is a WINapp.</p>

<pre><code> public bool LabelPrinting(DataTable dt, string LblPath)
    {
        if (File.Exists(LblPath))
        {
            string strContent = "";
            string comport = cboPort.Text.Trim();
            StreamReader myFile = new StreamReader(LblPath);

            strContent = myFile.ReadToEnd();
            myFile.Close();


            if (strContent.Length == 0)
            {
                return false;
            }
            else
            {
                char[] BigSpaceChars = { Convert.ToChar(0x09) };
                strContent = strContent.Replace(new string(BigSpaceChars), "   ");
                strContent = strContent.Replace("&lt;CPN&gt;", dt.Rows[0]["CPN"].ToString().ToUpper());
                strContent = strContent.Replace("&lt;RACKASSET&gt;", dt.Rows[0]["RACKASSET"].ToString().ToUpper());
                strContent = strContent.Replace("&lt;LOC&gt;", dt.Rows[0]["LOC"].ToString().ToUpper());

                Byte[] buffer = new byte[strContent.Length];
                buffer = System.Text.Encoding.ASCII.GetBytes(strContent);

                SafeFileHandle printer = CreateFile(comport,FileAccess.ReadWrite,0,IntPtr.Zero,FileMode.Open,0,IntPtr.Zero);

                if (printer.IsInvalid == true)
                {
                    return false;
                }



                 using (FileStream com = new FileStream(printer, FileAccess.ReadWrite))
                    {
                        com.Write(buffer, 0, buffer.Length);
                        com.Flush();
                        com.Close();
                    }


                }

               return true;
            }
</code></pre>