473,563 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ShowPaketRtfTex t(long lngPaketID, string strSprachID)
{

byte[] binaryData=null ;
DataSet PaketSet = oService.GetPak etTextBlocks(ln gPaketID,strSpr achID);
DataTable dataTable = PaketSet.Tables[0];
ArrayList pobjCombinedArr ays = new ArrayList();
foreach(DataRow Row in dataTable.Rows)
{
binaryData = (byte[])Row["VERSION_TE XT"];
pobjCombinedArr ays.AddRange(bi naryData);
}

byte[] pbytCombinedArr ays = new byte[pobjCombinedArr ays.Count];
pobjCombinedArr ays.CopyTo(pbyt CombinedArrays) ;

System.IO.Memor yStream stream = new
System.IO.Memor yStream(pbytCom binedArrays);
RTFTextBlock.Lo adFile(stream, RichTextBoxStre amType.RichText );
}
Nov 15 '05 #1
2 7802
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.co m

"nitin8or" <bh**********@y ahoo.com> wrote in message
news:8e******** *************** ***@posting.goo gle.com...
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 ShowPaketRtfTex t(long lngPaketID, string strSprachID)
{

byte[] binaryData=null ;
DataSet PaketSet = oService.GetPak etTextBlocks(ln gPaketID,strSpr achID);
DataTable dataTable = PaketSet.Tables[0];
ArrayList pobjCombinedArr ays = new ArrayList();
foreach(DataRow Row in dataTable.Rows)
{
binaryData = (byte[])Row["VERSION_TE XT"];
pobjCombinedArr ays.AddRange(bi naryData);
}

byte[] pbytCombinedArr ays = new byte[pobjCombinedArr ays.Count];
pobjCombinedArr ays.CopyTo(pbyt CombinedArrays) ;

System.IO.Memor yStream stream = new
System.IO.Memor yStream(pbytCom binedArrays);
RTFTextBlock.Lo adFile(stream, RichTextBoxStre amType.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.Memor yStream stream = new
System.IO.Memor yStream(binaryD ata);
RTFTextBlock.Lo adFile(stream, RichTextBoxStre amType.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
RichTextBoxStre amType.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
7553
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 shutdown and restart my XP machine but hasn't solve the problem. Can anyone help me? Thanks. Henry
9
2089
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
5817
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 change the formatting while typing text. Is there such a beast? Thanks, Neil
9
4792
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 use OpenArgs because sometimes I don't want an empty form and sometime I don't. I tried everything, but until now without success. I hope that...
3
5085
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 not support Clipboard function for images (Getdata or setData ) . I have
1
11727
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 fill rich text back to rich techbox (i set correct property "Rtf") i get whole text like: {...
1
1111
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 events that I see textbox has are: 1. DataBinding 2. Disposed 3. Init
7
1493
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 what's the difference between double balance;
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7634
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.