Rich Text Box Lines

nome_game

New member
Joined
Apr 18, 2005
Messages
4
Location
Texas
Programming Experience
Beginner
Dear Everyone,

We(a group of friends doing a college project) are trying to get a form to act similarly to the DOS Command Prompt to display previous entries. We are currently using a Rich Text Box to try this with but are considering using a list box. Problem is we want to see results after pressing Enter like so:

(going down like the Any Command Line Prompt)
1. Entered window
2. Echo
3. Howdy Horn Honkers
4. 3 5 +
5. 8

and so forth.

Any Help would be appreciated about the line advancement and coding on Pressing Return not just keypress.

Till then We'll persevere to find answers. Thank you all in advance.

Nome
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,874
Location
Sydney, Australia
Programming Experience
10+
I would suggest using a TextBox with the Multiline property set to True. You could then handle the KeyDown and/or KeyPress events to do what needs to be done when the user presses the Enter key.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
actually i would do the "line advancement" in the keypress event of the textbox like so:

VB.NET:
'rtbOutPut is a richtextbox and txtInput is a regular textbox

Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
	If Asc(e.KeyChar) = Keys.Enter Then
		If rtbOutPut.Text <> "" Then
		    rtbOutPut.Text &= ControlChars.NewLine & txtInput.Text
		Else
			rtbOutPut.Text = txtInput.Text
		End If
		txtInput.Text = ""
	End If
End Sub
 

nome_game

New member
Joined
Apr 18, 2005
Messages
4
Location
Texas
Programming Experience
Beginner
Thanks!! :)

Sheezy Creezy I was exstatic when that worked :) Thank you all very much once again the code was used and modified of course to fit into the program but it still works like a charm and I learned a new Key Word! :D Dang Good Site to be a part of :D... One day I'll be able to help others like you folks help me :) Thank Thank Thank You all :)


Nome
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
If you actually trying to make a program that looks like DOS there's always a console app. It may not be what your looking for but I thought I'd suggest it just it case...
 
Top