C# 将RichTextBox中内容的文档以二进制形式存

private void button1_Click(object sender, EventArgs e)
        {

             System.IO.MemoryStream mstream = new System.IO.MemoryStream();
            this.richTextBox.SaveFile(mstream, RichTextBoxStreamType.RichText);
            bWrite = mstream.ToArray();
            //如需保存,则以二进制的形式存入数据库.
            //sqlHelper.RunSql("insert into XXX (XX) values (@XX)", pram);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //  DataTable dt=sqlHelper.GetDataTable("select XX from XXX where .....");
           // byte[] bWrite = (byte[])dt.Rows[0][0];

            System.IO.MemoryStream mstream = new System.IO.MemoryStream(bWrite, false);

            this.richTextBox.LoadFile(mstream, RichTextBoxStreamType.RichText);

        }

上一篇:linux shell 字符串操作(长度,查找,替换)详解


下一篇:java 线程的几种状态