Solved

Multiline Textbox text problem

Posted on 2004-08-17
9
354 Views
Last Modified: 2012-05-05
Hi,

I am using a multiline textbox, but when the text goes beyond the boudries (vertically) I have to scroll to see the newest text.  For example:

My textbox is 5 lines vertically.  I have a button that adds an incrementing integer to the textbox on a new line at each click.  If I click the button 10 times, I will only see 1
2
3
4
5
then I have to scroll down to see the remaining number.  Is there a way to automatically scroll so that the latest piece of text is alway svisible, and the top text disapears above the boundries...?

Thanks guys...
0
Comment
Question by:jakekula
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
How are you adding the text to the textbox?  This works for me:

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Static lineNumber As Integer
        lineNumber = lineNumber + 1
        TextBox1.AppendText(lineNumber & vbCrLf)
    End Sub

End Class

Regards,

Idle_Mind
0
 

Author Comment

by:jakekula
Comment Utility
I am using the following code:

TextBox1.Text &= vbCrLf & "some text"

0
 
LVL 14

Expert Comment

by:ptakja
Comment Utility
The try what Idle_Mind suggested...  

TextBox1.AppendText("Some Text" & Environment.Newline)
0
 

Author Comment

by:jakekula
Comment Utility
Thanks guys, the problem is that I'm using VB.Net Compact Framework as I'm developing for a Pocket PC.  The AppendText() function is not available.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Expert Comment

by:Scoobyed
Comment Utility
this is available on compact framework textbox

Me.txtMessage.ScrollToCaret()
0
 

Author Comment

by:jakekula
Comment Utility
Thanks Scoobyed,  so how would I implement it into my code...?

Currently I am using

Textbox1.text &= vbCrLf & "some"

Textbox1.text &= vbCrLf & "sort"

Textbox1.text &= vbCrLf & "of"

Textbox1.text &= vbCrLf & "message"




0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
Like this:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        cfAppendText(TextBox1, "some")
        cfAppendText(TextBox1, "sort")
        cfAppendText(TextBox1, "of")
        cfAppendText(TextBox1, "message")
    End Sub

    Private Sub cfAppendText(ByVal tb As TextBox, ByVal msg As String)
        tb.Text &= vbCrLf & msg
        tb.SelectionStart = tb.Text.Length
        tb.SelectionLength = 0
        tb.ScrollToCaret()
    End Sub
0
 
LVL 3

Expert Comment

by:Scoobyed
Comment Utility
should I not get an assist for that?
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
I agree Scoobyed.

jakekula,

Please consider posting a request in Community Support to change the point allocations.
http://www.experts-exchange.com/Community_Support/

Idle_Mind
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now