Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Components & Controls > Editors

Editors GUI components such as masked edit, calculators, up/down controls, calendar, time, color pickers, etc.

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-14-2009, 2:23 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 3
Reputation: 0
Kelvin Perez is on a distinguished programming path ahead
Unhappy Limit RichtextBox

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-14-2009, 2:55 PM
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Location: USA
Posts: 877
Reputation: 500
MattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond repute
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-15-2009, 10:33 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 3
Reputation: 0
Kelvin Perez is on a distinguished programming path ahead
Default

Cool!!! Thanks!!! Will try it ASAP....


Just one question: By setting it to 10 lines, will the remaining lines be deleted or just scrolled?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-15-2009, 11:21 AM
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Location: USA
Posts: 877
Reputation: 500
MattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond repute
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-16-2009, 7:41 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 3
Reputation: 0
Kelvin Perez is on a distinguished programming path ahead
Default

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!!!!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 4:44 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.