473,765 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Suspect error using RichTextBox Class in server code

Using the 1.1 framework. We are using a newly created instance of a
RichTextBox Class in our server code to manipulate RTF that is stored
in the database. To clarify, we are not using or attempting to use
this class in the aspx page that calls the code, nor is the 'using
System.Windows. Forms' referenced in any of the aspx pages. The first
client using this software has been experiencing an error that we
cannot reproduce in-house. The error occurs intermittently anywhere
after 2-4 days of use, so it is not something reproducible on demand.
The fix is to restart IIS and on a couple of occasions a restart of
the server was necessary. The error is being trapped in code and
returned as string to the user which displays on the aspx page so it
is not an unhandled exception with a dump of the stack trace. The
error message is 'Error creating window handle". Once one user
receives this error all users receive the same error when trying to
perform the same operation. I am not 100% sure that the RichTextBox
code is what is causing the error but based on the message involved it
is my best guess. Here is a code snipit that shows how we are using
the RichTextBox.

string strFreeRTF = drRow["FRTF"].ToString().Tri m();
string strTempRTF = drRow["TMPLTRTF"].ToString().Tri m();
RichTextBox rtfFree = new RichTextBox();
rtfFree.Rtf = strFreeRTF; //prevents null reference
RichTextBox rtfTemp = new RichTextBox();
rtfTemp.Rtf = strTempRTF;
if(rtfTemp.Text .Length > 0)
{
rtfFree.AppendT ext("\r\n");
rtfTemp.SelectA ll();
rtfTemp.Copy();
rtfFree.Paste() ;
}
if(strCodedChar ting.Length > 0)
{
rtfFree.AppendT ext("\r\n");
rtfFree.AppendT ext(strCodedCha rting);
}

if(drChart["SUMMARY"].ToString() != "")
{
if(rtfFree.Text .Length > 0)
{
rtfFree.AppendT ext("\r\n");
}
rtfFree.AppendT ext(drRow["SMRYTXT"].ToString());
}
if(rtfFree.Text != "")
strRet = rtfFree.Rtf;
return strRet;

The code performs what it is designed to do but obviously we need to
track down why the error occurs.

Does anyone have information that might assist with troubleshooting
this problem. Thanks
Nov 18 '05 #1
1 2690
using winform controls are not supported by aspx pages. they require a
window handle to perform correctly, and system services like iis and
asp.net, do not have permission to create a window handle as they need
access to the desktop.

you might get away with it if the console is alway logged on the server, and
you gave permission. you still run the risk, that if the control pop's up a
dialog box (say for en error), your asp.net thread will be blocked until
some goes to the console and responds to the dialogbox.

this is very poor design, and you should look at replacing the rtf control
as soon as possible.

-- bruce (sqlwork.com)

"Eric" <ms*********@no spammediserve.c om> wrote in message
news:3f******** *********@news. devexpress.com. ..
Using the 1.1 framework. We are using a newly created instance of a
RichTextBox Class in our server code to manipulate RTF that is stored
in the database. To clarify, we are not using or attempting to use
this class in the aspx page that calls the code, nor is the 'using
System.Windows. Forms' referenced in any of the aspx pages. The first
client using this software has been experiencing an error that we
cannot reproduce in-house. The error occurs intermittently anywhere
after 2-4 days of use, so it is not something reproducible on demand.
The fix is to restart IIS and on a couple of occasions a restart of
the server was necessary. The error is being trapped in code and
returned as string to the user which displays on the aspx page so it
is not an unhandled exception with a dump of the stack trace. The
error message is 'Error creating window handle". Once one user
receives this error all users receive the same error when trying to
perform the same operation. I am not 100% sure that the RichTextBox
code is what is causing the error but based on the message involved it
is my best guess. Here is a code snipit that shows how we are using
the RichTextBox.

string strFreeRTF = drRow["FRTF"].ToString().Tri m();
string strTempRTF = drRow["TMPLTRTF"].ToString().Tri m();
RichTextBox rtfFree = new RichTextBox();
rtfFree.Rtf = strFreeRTF; //prevents null reference
RichTextBox rtfTemp = new RichTextBox();
rtfTemp.Rtf = strTempRTF;
if(rtfTemp.Text .Length > 0)
{
rtfFree.AppendT ext("\r\n");
rtfTemp.SelectA ll();
rtfTemp.Copy();
rtfFree.Paste() ;
}
if(strCodedChar ting.Length > 0)
{
rtfFree.AppendT ext("\r\n");
rtfFree.AppendT ext(strCodedCha rting);
}

if(drChart["SUMMARY"].ToString() != "")
{
if(rtfFree.Text .Length > 0)
{
rtfFree.AppendT ext("\r\n");
}
rtfFree.AppendT ext(drRow["SMRYTXT"].ToString());
}
if(rtfFree.Text != "")
strRet = rtfFree.Rtf;
return strRet;

The code performs what it is designed to do but obviously we need to
track down why the error occurs.

Does anyone have information that might assist with troubleshooting
this problem. Thanks

Nov 18 '05 #2

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

Similar topics

4
3510
by: John Broderick | last post by:
I've got a problem with the RichTextBox control in .Net where the garbage collector doesn't reclaim its memory after I've finished with it. My program adds a series of rtb's to the control array of a panel to make a basic text editor. When the form that the panel is on is closed these rtb's are still in memory. If you want to see the probelm try this: create a form which has a panel on it. Create a class,
2
14501
by: Saiyou Anh | last post by:
I have two questions: (1) How can we diagnose the reason of database suspect? The error log doesn't tell me much. (2) After restart the server, the suspect is gone, but how can I ensure everthing is fine? DBCC check? Thanks! Saiyou
1
1772
by: Terminal882003 | last post by:
Hi, I have a problem in my application(C#) if I using RichTextBox to continuously display a series of text messages (using method AppendText()). When application is running, it will stop at some point (randomly), the error message is: ********************************* System.NullReferenceException: Object reference not set to an instance of an object.
1
1596
by: Henry | last post by:
I inherited a richtextbox class and tried to add the double click even handler. Unfortunatly, when I check the properties of rtbText, it doesn't contain a double click event handler. Any ideas on what I did wrong or how i can add a double click event handler to a richtextbox? //I declared rtbText as my custom richtextbox rtbText = new DblClickRich() //Custom Richtextbox class trying to add double click event handler public class...
4
5947
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the TabControl the first thing it says is (not real var names):
10
11661
by: D Steward | last post by:
I can't seem to add a newline (/n) to get a richtextbox control to display text on successive lines. The text that I type is overwritten. How do I remedy this My example richTextBox->Multiline = true richTextBox->Text = S"First line /n" richTextBox->Text = S"Second line" Thanks
3
7186
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to just add plain (e.g.. rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a different color or font size. Find() will not work because the text will vary. I have delimiters on it so I could recognize it with a regular ...
2
2356
by: =?Utf-8?B?TUs=?= | last post by:
Hello , I am developing a white board type stand-alone VB .NET application in which the .EXE application will be installed in two or more different client machines . These client machines will interact with each other in the way that during drawing with mouse using graphics on RichTextBox control used as white board , whenever the mouse_up event occurs in either client , the whole graphics on the RichTextBox will be shown on every...
8
8947
by: =?Utf-8?B?Q2hyaXMgSGFsY3Jvdw==?= | last post by:
Hi there I've successfully added some .NET validation controls to a page (using <asp:RequiredFieldValidator ...), however when I try to set the 'display' property to 'dynamic', my page then throws up the following error in the browser: CS1061: 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Web' and no extension method 'Web' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found...
0
9398
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9832
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7375
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3924
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
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.