Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multiline Textbox text problem

Posted on 2004-08-17
9
Medium Priority
?
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 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