Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multiline Textbox text problem

Posted on 2004-08-17
9
Medium Priority
?
369 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 86

Expert Comment

by:Mike Tomlinson
ID: 11827689
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
ID: 11827786
I am using the following code:

TextBox1.Text &= vbCrLf & "some text"

0
 
LVL 14

Expert Comment

by:ptakja
ID: 11829683
The try what Idle_Mind suggested...  

TextBox1.AppendText("Some Text" & Environment.Newline)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:jakekula
ID: 11836238
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
 
LVL 3

Expert Comment

by:Scoobyed
ID: 11838614
this is available on compact framework textbox

Me.txtMessage.ScrollToCaret()
0
 

Author Comment

by:jakekula
ID: 11838631
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 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 11840561
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
ID: 11850537
should I not get an assist for that?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 11851025
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Screencast - Getting to Know the Pipeline
Suggested Courses

971 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