![]() |
|
|||||||
| Editors GUI components such as masked edit, calculators, up/down controls, calendar, time, color pickers, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi:
I'm new to VB2008 (from old VB6 school). I'm going crazy with a small app I'm making. I'm running a loop and displaying the results in a RichtextBox but I want to limiting the display to always show the last 10 lines (Like the previous line go up beyond the user's view). ![]() Any suggestions will be greatly appreciated. Best Regards: KP |
|
|||
|
Size your RichTextBox to 10 lines in height. ScrollToCaret will cause the RichTextBox to scroll to the bottom where you just added the line.
Code:
Public Class Form1
Dim i As Integer = 1
Private Sub uxAddLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles uxAddLine.Click
If Me.RichTextBox1.Text.Length = 0 Then
Me.RichTextBox1.AppendText("Line: " & i)
Else
Me.RichTextBox1.AppendText(Environment.NewLine & "Line: " & i)
End If
Me.RichTextBox1.ScrollToCaret()
i += 1
End Sub
End Class
|
|
|||
|
I manually adjusted the height to only show 10 lines worth of data (135px worked well for my default font).
As I was clicking my button to add lines the additional lines were scrolled out of view. |
|
|||
|
GREAT!!!!!!!!!!! It worked perfectly!!!! I'm so glad.....and so dumb.....I was going crazy saving lines to arrays and re-arranging the arrays and clearing the box and it was so simple.....
![]() Thanks a lot for your help....I really appreciate it!!!!!!!
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|