I've got a multiline textbox that I'm using to display messages. Is there an
easy way to have it scroll to the end after I add a line to the text of the
box?
TIA - Jeff. 6 8764
UJ wrote: I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box?
TIA - Jeff.
The only way I've found, is to use Windows messages ... Not nice but the only
solution I ever found.
using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint="SendMessageA")]
static extern uint SendMessage(System.IntPtr hwnd, uint wMsg, uint wParam, uint
lParam);
const int WM_VSCROLL = 0x115;
const int SB_BOTTOM = 7;
TextBox report ;
void printError(string msg)
{
...
// auto scroll to bottom of text control
SendMessage( this.report.Handle, WM_VSCROLL, SB_BOTTOM, 0);
}
cyrille
Jeff,
Here's a very simple technique that works with a RichTextBox; should
work with a regular TextBox also:
RichTextBox.Select(RichTextBox.TextLength, 0);
RichTextBox.ScrollToCaret();
Hope this helps,
John Bendiksen
# Cyrille37 # wrote: UJ wrote: I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box?
TIA - Jeff.
The only way I've found, is to use Windows messages ... Not nice but the only solution I ever found.
using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint="SendMessageA")] static extern uint SendMessage(System.IntPtr hwnd, uint wMsg, uint wParam, uint lParam);
const int WM_VSCROLL = 0x115; const int SB_BOTTOM = 7;
TextBox report ;
void printError(string msg) { ... // auto scroll to bottom of text control SendMessage( this.report.Handle, WM_VSCROLL, SB_BOTTOM, 0); }
cyrille
Jeff,
Here's a very simple technique that works with a RichTextBox; should
work with a regular TextBox also:
RichTextBox.Select(RichTextBox.TextLength, 0);
RichTextBox.ScrollToCaret();
Hope this helps,
John Bendiksen
# Cyrille37 # wrote: UJ wrote: I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box?
TIA - Jeff.
The only way I've found, is to use Windows messages ... Not nice but the only solution I ever found.
using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint="SendMessageA")] static extern uint SendMessage(System.IntPtr hwnd, uint wMsg, uint wParam, uint lParam);
const int WM_VSCROLL = 0x115; const int SB_BOTTOM = 7;
TextBox report ;
void printError(string msg) { ... // auto scroll to bottom of text control SendMessage( this.report.Handle, WM_VSCROLL, SB_BOTTOM, 0); }
cyrille
JohnAtAphelion wrote: Jeff,
Here's a very simple technique that works with a RichTextBox; should work with a regular TextBox also:
RichTextBox.Select(RichTextBox.TextLength, 0); RichTextBox.ScrollToCaret();
hello,
I'm afraid that not the right solution.
Before found the solution with Windows Message, it was the first thing I've used.
But it does not work it the control has not got focus. Hope this helps, John Bendiksen
# Cyrille37 # wrote:
UJ wrote:
I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box?
TIA - Jeff.
The only way I've found, is to use Windows messages ... Not nice but the only solution I ever found.
using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint="SendMessageA")] static extern uint SendMessage(System.IntPtr hwnd, uint wMsg, uint wParam, uint lParam);
const int WM_VSCROLL = 0x115; const int SB_BOTTOM = 7;
TextBox report ;
void printError(string msg) { ... // auto scroll to bottom of text control SendMessage( this.report.Handle, WM_VSCROLL, SB_BOTTOM, 0); }
cyrille
Cyrille37,
Not sure why it didn't work for you...
In my 'process control' type application, I am updating 4 RichTextBoxes
continuously with status information (probably similar to Jeff's
situation). None of them ever have focus; in fact, they are not even
selectable by the user. They all scroll properly to the last added
text using this technique.
Happy coding,
John Bendiksen
On Wed, 1 Feb 2006 11:41:13 -0500, "UJ" <fr**@nowhere.com> wrote: I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box?
TIA - Jeff.
Set HideSelection to false.
Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: GrantS |
last post by:
I am trying to convert the VB.Net code example povided by
http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx
into C# (ASP.Net)without success. No errors are thrown in the VB...
|
by: abs |
last post by:
How to detect that user started to scroll the page ? Separately vertical and
horizontal scroll. Is it possible ?
Regards,
ABS
|
by: justdummy |
last post by:
Hi,
I am struggling with a problem for sometimes. I need to display a table in
a html and if the height of the table goes beyond 200 px then a vertical
scrollbar should alone appear without any...
|
by: J-T |
last post by:
My website is fine when it is viewed in 1280 by 1024 pixel ,but in smaller
resulotions there is a horizontal scrollbar down the page.How can I set it
to be viewed the same for all resulotions?
...
|
by: JonnyT |
last post by:
I searched high and low for an answer on how to auto scroll a
richtextbox and now I finally have it. Since it took me a while to
get a good efficient way of doing it that didn't require focus to...
|
by: Ima Loozer |
last post by:
On one of my forms I have a text box sized and shaped to display
multiple lines. The max content of the field is such that the text box
may display less than all of the data in the field. ...
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
I'm using the VScrollBar and set it as follow:
m_vScrollBar.Minimum = -19602;
m_vScrollBar.Maximum = 0;
m_vScrollBar.SmallChange = 1;
m_vScrollBar.LargeChange = 1089;
m_vScrollBar.Value =...
|
by: Tripmaker |
last post by:
I'm trying to set u a scroll bar to be attached to the text area with a border around it. The problem is my text area appears as a small screen above the bordered/scrolled text area.
Here is my...
|
by: crazy works |
last post by:
hello guys,
i have problem in the scroll bar on my css code , i am trying to use that css menu from that link http://www.cssplay.co.uk/menus/slide_fly.html
it actually works very good but i want...
|
by: PrabodhanP |
last post by:
I have CSS based mouseover scrolling for divContent embeded in my webpage.It works fine in IE,but not working in mozilla-FF.
It is located at the location.....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |