473,405 Members | 2,444 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,405 software developers and data experts.

RichTextBox and Timer

Hi all,
I would really appreciate if someone cound point me to the right direction,
regarding the issue I have. Or suggest another solution.

I have a VB.NET windows service that is processing XML files from a specific
folder, and that works fine. But, what I would like to do now is create a
side application (or within the same app) that is responsible for monitoring
the whole process. When I say monitoring, I mean a form that displays which
file has been processed and when. Right now, I can do that by having the
service right to a log file, and than read a log file and store the text
into a read-only RichTextBox control. The refresh of the RTB is controlled
by a Timer control. The problem with this is that the RTB flickers, no
matter how I set the Timer. This is the result of having to get the whole
log file text, bind it to RTB and have it scroll down to the end

Now, I was wondering if there is any other way to accomplish the same thing,
and how?
- Service writes to a command window
- Service appends text directly to a RTB (not sure if I can have a WinForm
as a part of WinService project; maybe separate projects)
- RTB gets only the latest info from log file, since the last timer tick
(read lines from the last end-line to the current end-line, or something
like that)

Any suggestions?

Thanks
Goran Djuranovic
Apr 21 '06 #1
1 2135
In case someone else has the same problem, I have fixed the flickering by
using this:
*************
Private Const WM_SETREDRAW As Int32 = &HB
Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hwnd As
IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32)
As Int32
*************

and this:

*************
SendMessage(RichTextBox1.Handle, WM_SETREDRAW, False, 0)
RefreshTextBox(TextStr)
SendMessage(RichTextBox1.Handle, WM_SETREDRAW, True, 0)
RichTextBox1.Focus()
RichTextBox1.Refresh()
*************

But, I would still like to know if there is any other way for the windows
service to write to a winform or a command window.

TIA
Goran Djuranovic


"Goran Djuranovic" <djurag@REMOVE_TO_MAILmmc.org> wrote in message
news:ON**************@TK2MSFTNGP04.phx.gbl...
Hi all,
I would really appreciate if someone cound point me to the right
direction, regarding the issue I have. Or suggest another solution.

I have a VB.NET windows service that is processing XML files from a
specific folder, and that works fine. But, what I would like to do now is
create a side application (or within the same app) that is responsible for
monitoring the whole process. When I say monitoring, I mean a form that
displays which file has been processed and when. Right now, I can do that
by having the service right to a log file, and than read a log file and
store the text into a read-only RichTextBox control. The refresh of the
RTB is controlled by a Timer control. The problem with this is that the
RTB flickers, no matter how I set the Timer. This is the result of having
to get the whole log file text, bind it to RTB and have it scroll down to
the end

Now, I was wondering if there is any other way to accomplish the same
thing, and how?
- Service writes to a command window
- Service appends text directly to a RTB (not sure if I can have a WinForm
as a part of WinService project; maybe separate projects)
- RTB gets only the latest info from log file, since the last timer tick
(read lines from the last end-line to the current end-line, or something
like that)

Any suggestions?

Thanks
Goran Djuranovic

Apr 25 '06 #2

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

Similar topics

8
by: S.W. Rasmussen | last post by:
A trivial (?) question: does anyone know how to change the shape of the cursor in a RichTextBox control from the normal vertical line to an underscore?
4
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...
5
by: user | last post by:
Hello When i add new lines of text to my RichTextBox, and when vertical scroll bar appear (there is more text than RichTextBox can display), RichTextBox always display "the oldest text" (vertical...
1
by: Jesper | last post by:
Hi, Im fairly new to C# but have som experience in the C++/MFC world and I am a bit confused as I cant find some information that I am used to having. I am trying to use the RichTextBox control...
1
by: marfi95 | last post by:
Hi all. I have some forms that use the opacity property to fade in/out. I'd like to do the same kind of thing with a richtextbox on one of my forms. Doesn't look like opacity is exposed on the...
4
by: Piotr | last post by:
1. When i refresh control, position of scrollbars is deleted. I can not change BackgroundImage from System.Windows.Forms.RichTextBox before text of control is painted and after. I tried use...
9
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how...
8
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have created a Control that extends RichTextBox to do syntax-hilighting. My strategy is to have a timer that restarts every time a user types a key so that it can wait until the user pauses for...
5
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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
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.