473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Cannot display both byte arrays in Rich TextBox ?Please help!

Hi ALL,

I want to display in a RichTextBox the Binary Large Objects data
coming from database. If I have one record its not a problem I convert
it to byte array and pass it on in a stream as a byte array and then
call Loadfile method of RichTextBox and pass the stream. This works
BUT IF

I have more records I have to create a loop and some how pass the
concatenated byte array and then pass it in a stream. I do this with
following code but when I see the RichTextBox I can see only one
Record and not all the records retrieved from database, I think reason
is the that in the stream all different byte arrays have start and end
header and stream shows only till the point it sees end header of
first record. Please help am i moving in right direction or is there
any other solution. Your reply would be highly appreciated. Thanks a
lot.

Here is the code for reference

private void ShowPaketRtfText(long lngPaketID, string strSprachID)
{

byte[] binaryData=null;
DataSet PaketSet = oService.GetPaketTextBlocks(lngPaketID,strSprachID );
DataTable dataTable = PaketSet.Tables[0];
ArrayList pobjCombinedArrays = new ArrayList();
foreach(DataRow Row in dataTable.Rows)
{
binaryData = (byte[])Row["VERSION_TEXT"];
pobjCombinedArrays.AddRange(binaryData);
}

byte[] pbytCombinedArrays = new byte[pobjCombinedArrays.Count];
pobjCombinedArrays.CopyTo(pbytCombinedArrays);

System.IO.MemoryStream stream = new
System.IO.MemoryStream(pbytCombinedArrays);
RTFTextBlock.LoadFile(stream, RichTextBoxStreamType.RichText);
}
Nov 15 '05 #1
2 7792
nitin8or,

I believe that this is the case. What you will have to do is append the
text somehow. You could have another RichTextBox that is not visible, load
the contents into that, then get the RTF for that textbox, and append it to
the RTF of the textbox that is being displayed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nitin8or" <bh**********@yahoo.com> wrote in message
news:8e**************************@posting.google.c om...
Hi ALL,

I want to display in a RichTextBox the Binary Large Objects data
coming from database. If I have one record its not a problem I convert
it to byte array and pass it on in a stream as a byte array and then
call Loadfile method of RichTextBox and pass the stream. This works
BUT IF

I have more records I have to create a loop and some how pass the
concatenated byte array and then pass it in a stream. I do this with
following code but when I see the RichTextBox I can see only one
Record and not all the records retrieved from database, I think reason
is the that in the stream all different byte arrays have start and end
header and stream shows only till the point it sees end header of
first record. Please help am i moving in right direction or is there
any other solution. Your reply would be highly appreciated. Thanks a
lot.

Here is the code for reference

private void ShowPaketRtfText(long lngPaketID, string strSprachID)
{

byte[] binaryData=null;
DataSet PaketSet = oService.GetPaketTextBlocks(lngPaketID,strSprachID );
DataTable dataTable = PaketSet.Tables[0];
ArrayList pobjCombinedArrays = new ArrayList();
foreach(DataRow Row in dataTable.Rows)
{
binaryData = (byte[])Row["VERSION_TEXT"];
pobjCombinedArrays.AddRange(binaryData);
}

byte[] pbytCombinedArrays = new byte[pobjCombinedArrays.Count];
pobjCombinedArrays.CopyTo(pbytCombinedArrays);

System.IO.MemoryStream stream = new
System.IO.MemoryStream(pbytCombinedArrays);
RTFTextBlock.LoadFile(stream, RichTextBoxStreamType.RichText);
}

Nov 15 '05 #2
Thanks Nikolaus,

I thought of it too and its working fine, but I have another issue, I
use

System.IO.MemoryStream stream = new
System.IO.MemoryStream(binaryData);
RTFTextBlock.LoadFile(stream, RichTextBoxStreamType.RichText);

Now here if stream is not with rtf codes and is only plain text I get
an error that Invalid file format because I am using
RichTextBoxStreamType.RichText, can you tell me how can I incorporate
such that I can show both palin text and rtf in richtextbox.

Thanks
Nitin80r
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: MJ23 | last post by:
Dear all, I have tried used the download version of oracle8i client and the CD come with oracle8i but after clicking the setup.exe file, it doesn't start and has no response. I have tried to...
9
by: John Guo | last post by:
Hi all, Please help see why this snippet does not compile. Thanks a lot. John #include <string> #include <vector> namespace PatternMsg { std::vector<std::string> msg(17);
2
by: Neil | last post by:
Is there an editable RTF textbox control which allows the user to apply bold, italic, etc.? I tried the Microsoft Rich Textbox Control, but there doesn't seem to be a way to allow the user to...
9
by: Sandy | last post by:
Hi all, I have a form to list records (frmListIssue) which I call from different other forms. My wish is to display a message when the form is called and empty; no records to display. I want to...
3
by: hermawih | last post by:
Hi , can anyone help me , please . In Ms Rich textbox control , It is easy to insert object than to insert picture . I want to insert picture in my Ms rtf activeX control but Ms Access does...
1
by: tomi.trescak | last post by:
Hi I have a problem with storing rich text in MySQL. I store rich text in MySQL (in column with type "text") which i get from Rich Textbox control. When i do reverse processing by trying to...
1
by: almurph | last post by:
Hi everyone, Is it possible to make a new events for a Web-form textbox. What I mean to ask is that I want an event to fire everytime a user enters a letter into a Web-form textbox. The only...
7
by: QiongZ | last post by:
I came across this when I was reading a book on Java. In the book, there is a note trying to explain what's equivalent in C++ to double balance = new double; // Java So my question is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.