Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Making A NEWLINE In A Textbox? How Do I Do It?


I have some variables i would like to put in a textbox, for example when the user types in something to another textbox it stores a variable and when you click a button the text displays something like this...text1.text "This is a variable " & myvarI want to be able to put a newline tag or something in there like this...text1.text "This is my" & newline & "variable " & myvarsomething to that nature.. if anyone could help i would really appreciate it.. someone else told me that it can be done with the CHR() tag??? PLZ HELP------------------- azpc




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Newline In TextBox
Hi
How do I put newline in a text box?
Problem is, I want multi-line outputs in a textbox
e.g.
a is 10
b is -56
c is 23

etc.
But when I use the following
Text5.SelStart = Len(Text5.Text)
Text5.SelText = "a is 10"
Text5.SelStart = Len(Text5.Text)
Text5.SelText = "b is -56"
etc.
it results in a long string of text, like
a is 10b is -56
and so on

Any help will be highly appreciated
Thanks in advance
Anjan

Newline In Textbox
I have a vb program im working on and i display a lot of records and junk in a textbox. My question is how the f do I tell the textbox to go to a newline without filling up the line im currently on. I have tried everything and its annoying. C has
why is vb so difficult?

thanx for da help

NewLine In TextBox
I have a TextBox with multiline property set to true. The text contained in this TextBox comprises of strings acquired from different fields in my database. I want to separate each of these strings by a 'NewLine' character so eash string comes on a new line. How do I do this?

I tried using SendKeys("{ENTER}") but it didnt work.

Auto Newline When End Of Textbox Lol
i finally done with ym encrypt and decrypt part.. but then i saw that al lthe text wil lgo in one line.. how do i set my text box up to newline when reachin the end of the textbox?

Textbox, Multiline, Newline
I want to beable to modify the text1.text so each time I 'enter' something it goes on a newline something like.

Text1.text = Text1.text & newline & "Hello"

So if text1.text said
Hi.

After using that it would say.

Hi.
Hello

Newline In A Multiline Textbox
How do you put a newline in a MULTILINE textbox?

Display NewLine In Textbox
I have tried to display multi-line in a textbox by a string..
abc = "firstline"+chr(13)+"secondline"
textbox.text = abc

but it doesn't display in different line.
is it there special charactor to show newline and what is it??

Searching Newline Characters In Textbox
Code:

nl = vbNewline or Chr(13)

lb(i) = InStr(b, ls, nl, vbTextCompare)



What code do i have to put after nl to find when a textbox has a newline ? Chr(13) did the work for me in Excell but it won't respond in VB6.0

It's about a textbox which has multiple lines and i want to analyze the lines one by one, so i find the Chr(13) and break the string in pieces, and anyalyze the piece as a separate string.

Any suggestions ?

Thanx in advance

How To Insert A Newline Character In Textbox?
i want to print few strings in the textbox ,but i don't know how to use newline character to seperate them.

Code That Display Data In Newline In The Textbox
who know the code that display data in newline in the textbox?
A very thanks for immediate help. Thanks you for reading

Code That Display Data In Newline In The Textbox
who know the code that display data in newline in the textbox?
A very thanks for immediate help. Thanks you for reading

Below is my code

Making A Textbox
How do you create a textbox by code?

Thanks.

Making A Textbox Scroll Down
i am making a game using winsock.
when the players chat, i add the message to the bottom of a text box.
when the text is added, the text box does not scroll to the bottom, after a few lines, to see the message, u must scroll down yourself.

how can i make the textbox always stay scrolled to the bottom?

thanks!

Making TextBox Visible
In one of my applications I have a frame that contains 2 textboxes.
As this frame is added at runtime I have placed one on a form at design time and set the visible propertie to false. When I want to add a frame at runtime run the following code.

'start a count tracking the array element
ArrayCount = ArrayCount + 1

'load the 3 objects of the sticky note
Load frmborder.Frame(ArrayCount)
Load frmborder.Title(ArrayCount)
Load frmborder.Text(ArrayCount)

'sets the sticky note objects to equal that entered
frmborder.Title(ArrayCount).Text = frmkeyboard.txttitle.Text 'Title
frmborder.Text(ArrayCount).Text = frmkeyboard.txttext.Text 'Text

'make the objects visible
frmborder.Title(ArrayCount).Visible = True
frmborder.Text(ArrayCount).Visible = True
frmborder.Frame(ArrayCount).Visible = True

This does add the frame and the textboxes but it only sets the frame to visible, leaving both the Title and Text textboxes invisble.

Does anyone have any ideas on why this is happening and how I can get roung this.


Thanks P

Making A New Line In Textbox
Hi!


I try to make a new line (line feed & carriage return) in a textbox, but it appears as a black box. I have enabled mulilines for my textbox. How do I solve this relative simple problem??

Here is some code that might explain my problem even more (text1 is a textbox):

Dim line1 as string
Dim line2 as string

line1 = "this is line 1"
line2 = "...and this is line 2"

text1.text = line1 & chr(10) & chr(13) & line2

When I do this 2 black boxes appears between the text from line1 and line2. I have tried to use only one of LF & CR, but it doesn't matter...

Please help!!

Regards riley

Making Spaces In Textbox
Hi i want to create a Word program kinda like.
I'm using the Dim Writer/reader to save my notes in a specific folder.
I have enlarged a textbox and want to make it understand what i want example.

I write in textbox
A
B
But in my saved document it's A B, how do i make it so it's get that space i want it to ?

Making Textbox Transparent???
hihi..

how can i do to make the textbox is transparent background? i tried using label for the transparent attribute, but it fails when the texts in the textbox is too long, the text in the label will not automatically go to the next newline. How can i over come this? i am trying to type any text in the textbox, and it will show in the label.

???
ocw

Making Textbox Disappear
Hello,

I've got a textbox, which, by default (on Page_Load) is not visible. When the user clicks on the word "logoff" the password box becomes visible. This is done simply by the following:


VB Code:
If txtPwrd.Visible = False ThentxtPwrd.Visible = TrueElse:txtPwrd.Visible = FalseEnd If


The point of this is the following. This is a CUSTOMER (not an employee) lookup screen. To prevent customer's from bailing out of the program and just peeking around the computer, I've locked the form (and disabled maximize,minimize, and close).

The only way for this form to close, is via a LOGOFF password which the employees will have.

My question is:
How can I have the textbox "disappear" again, if nothing is entered in, say, five seconds.

I'm guessing a timer, but I've never used these before, and I'm not sure where in my code I'd want to place it.

Any ideas?

<EDIT: You Guys are GENIUSES! RESOLVED!>

Making Rich TextBox???
I am currently using a multi-line text box, but I would like to enhance the look a little bit. Could someone tell me how I go about making a rich textbox.

Thanx.

Making All Characters Except &#039;0&#039; Appear In Textbox
I have a form with an array of textboxes. A different number, between -12 and 12, loads into the textboxes at random when the form loads.

I use this code:

Private Sub Form_Load()
Randomize Timer
Text5(0).Text = Int((10 + 13) * Rnd - 10)
Text5(1).Text = Int((10 + 13) * Rnd - 10)
Text5(2).Text = Int((10 + 13) * Rnd - 10)
Text5(3).Text = Int((10 + 13) * Rnd - 10)
Text5(4).Text = Int((10 + 13) * Rnd - 10)
Text5(5).Text = Int((10 + 13) * Rnd - 10)
Text5(6).Text = Int((10 + 13) * Rnd - 10)
Text5(7).Text = Int((10 + 13) * Rnd - 10)
For X = 0 To 7
If Rnd > 0.5 Then
Text5(X).Text = "+" & Int(Rnd * 12)
End If
Next X

I want to have it so that '0' doesn't appear in the textboxes - if it happens to come up at random. I thought that placing the code below, between the 'End If' and 'Next X' above, would do it. but it doesn't:

If Val(Text5(index).Text) = 0 Then
Text5(index).Text = "3"
End If

Could someone please tell me how I can do it?

Thanks!

Making A Textbox Uppercase Only
I looked at the FAQ with textboxes and it has me confused... can someon provide me with a way to make say textbox.text all uppercase when button1 is pressed. Thanks a mill..


Justin

Making A Textbox Only Except Numbers
How can I make a textbox only except numbers?? I want it to only except 5 numbers (the zip code)

please help me

Making Special Textbox Border
hi,

i use to have the source code to do this, but now i have lost it. i want to get my textbox to have a border like this. i used to have a bas with a "createborder" function where i would do createborder(text1.text), etc. does anyone know how i can do this now? i can't seem to find anything relating to this kind of textbox...

i've attached a screen shot of what it is:

Making The State IE (GA Or OK Or AX) Ect Show In TEXTBOX
I am wanting a user when typing in txtState textbox the first letter of a state to have the state appear in the textbox.

If they typed "g" or "G" then "GA" would appear I have seen this done before on a Form via the internet......

What I cant rember how they handled was those states that start or begin with the same Letter..

I found some code that Validates States..... Here it is only I am not sure how to use it exactly with the textbox or if this is what I am needing..


Need some help on this one!!!


Code:
' If this is what I need How would I use this wouldnt I need to
' Dim strState As String and also Dim Validate?
Select Case UCase(strState)
Case "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", _
"DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", _
"KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", _
"MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", _
"ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", _
"TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"
ValidateState = True
Case Else ' It's not a postal state code.
ValidateState = False
End Select
vbMarkO

Making A Input Mask For A Textbox
How can you make a input mask for a textbox.
It has to look like this:
xxº-xx.xx' x

The first 5 x's can only be numbers and the last x can only be a N,E,S or W.
Can anyone tell me how to do this??

Making A Textbox Scroll In Access97
IN VB..when you add to a textbox...it scrolls down..showing the last line added...

In Access97 it doesnt...I need it to

any ideas?

Making The Enter Key Work With A Textbox?
Hi,
Is this the proper way to get my program respond to the Enter key the same as if the Command button that says "Go" is clicked?
It seems to work but is there a better way?

Code:
Sub Text1_KeyPress(KeyAscii As Integer)
Text1.SetFocus
If KeyAscii = 13 Then GetData
End Sub

As always, Thanks.
Al.

Making Textbox And Combobox Visible
I need to have a textbox and a combobox to be invisible to start but if someone clicks on the Optionbutton "Yes" to have them the textbox and combobox to be visible. I have tried several variations of the code below but none seem to work. Any help me?

Private Sub Upgrade_Click()
If Upgrade(1).Value = 1 Then
UpgradeDate.Visible = True
UpgradeDateLabel.Visible = True
UpgradeTo.Visible = True
UpgradeToLabel.Visible = True
End If
End Sub

Thanks.


------------------
Stanley

Making Textbox So User Can't Highlight Text
Is there a way to make a multiline textbox so the user can't highlight the text? I tried using the enable property but when I set the enabled property to false, the control will not allow the user to scroll down to other lines in the textbox.

The reason I'm doing this is so I can just use one textbox control to display and edit information instead of using a label to display and a textbox to edit.

Making A Textbox Grow Vertically , Automatically
Hi

I am trying to get a multiline textbox to automatically expand vertically when it can no longer contain any more text (a la th 'To' line in Outlook)

Whilst this can be easily accomplished with a fixed widt font, anyone have any ideas using regular fonts? No events triggered when the first line "overflows" or whatever -

Any ideas gratefully appreciated...

What Is The Correct Way Of Making First Letter Of Textbox Caps
im trying to make the first letter of the text in upper case and the rest in lower case
i tried this but it doesnt seem to work very well

text1.text = UCase(Left(text1.text, 1)) & LCase(Mid(text1.text, 1, -1))

Making A Form Behave Like A Textbox Control
I want a form to behave like a textbox control.

(A) put text on it
(B) be seletable
(C) be editable.

putting text on a form posses no problem, I can use API for that but how to make it selectable and editable at the same time??

I thought if i could find code that built a textbox control from scratch, that would give me some idea, do you know where to find code such as I've look every where i can think.

furthermore the text must beable to be placed anywhere on the form.

the pig..

Making A Textbox Scroll To The Bottom On Every Update
Hi my name is Will and I am having a problem with a rich text box in my program. You see, I am working on an encryption and then I want to decrypt the text and put it into a text box. But the text can be larger than the text box so I have scroll bars. But every time I want the user to be able to update it, the text box starts from the top and they have to keep scrolling down and that can get very boring after a while. So what I need is to be able to make the text box scroll all the way to the bottom when it has a changed event. A good analagy would be AOL's IM's. They always scroll to the bottom when someone sends a message. Thank you for your help. It will be greatly appreciated!

-Will

Need Asst. On Making TextBox Behavior More Like Forms 2.0 Controls
Two things I desire: world peace and a VB textbox that behaves like the textbox used in VBA for MS Access. I'm hoping at least one of these is practical.

What I'd like to mimic is this...

When a user tabs into the textbox, select all of the text within the box BUT do not scroll the textbox to the end of the string. I've been able to select all the text using SelStart = 0 and SelLength = Len(Str$) but that actually moves the cursor to the end of the string and on lengthy MultiLine fields can totally confuse the users as to where they are. I also tried Sendkeys {END}+{HOME} but this is interrupted by return carrier characters so it fails on MultiLines.

When a user single clicks on the field using the mouse, simply place the cursor at the location they clicked on. Make no attempt to select any portion of the string.

When a user double clicks on the field, use existing behavior.

Any help on this would be greatly appreciated.

Casey

Making Textbox Text Bold During Runtime While Transfering To Datareport
I have text box in form and datareport and
my scenario is,
1.I have a textbox in a form and textbox in a datareport
2.I typed some text in the text box
3.When i click a command button the content of the text box moves to datareport textbox
4.In this, I want the particular word in the text should be bold while displaying in the datareport textbox, since the Bold word is the heading in the data report textbox.
5. Changing the datareport textbox font to bold during design time will result all the text in the textbox to bold.But i need only the particular word bold it may done only during runtime i think.

Newline?
Hi, I'm just wondering how can you make:



With objMailItem
.To = DataComboAssignedTo.Text
.Subject = "Test"
.Body = "Record Number: " + txtRecNo.Text + ", " & _
"Request Date: " + txtDate.Text + ", " & _
"Requested by: " + txtName.Text + ", " & _
"Problem/Request: " + txtProblem.Text + ""

.CC = ""
.Attachments.Add "Path"
End With

objMailItem.Send
Set objMailItem = Nothing
Set objOutlook = Nothing


display like this when I view the message in OUTLOOK:



Record Number: 'whatever number * firstline
Request Date: 'Date Requested * newline
Requested by: 'your name * newline
Problem/Request: 'Description of the prob * newline

Newline
i have been searching through the site for a method to make a newline in a textbox.
eg. in a text file i have got
Reynolds Josh HIS GEO ENG MUS GST 03/04/85
Smith Diana FRE GER JAP
Johnson Sukwinder MAT PHY 23/06/85
i have made a button so that when it is clicked, it will read in the above lines into a textbox in VB6

But this is what appears
Johnson Sukwinder MAT PHY 23/06/85Smith Diana FRE GER JAPReynolds Josh HIS GEO ENG MUS GST 03/04/85

All three line are together in one line!

Can someone help please, i need some simple code that i can understand please.

thanks very much.

Newline
hello.

Im sorry for being so stupid, but how would i make a messagebox have 2 lines of text, like i want a message box that looks like ythis:

hello
how are you?

with a LINE break. what is the linebreak character?

Newline
the vb.net code for a new line is controlchars.newline. what is the equivelant in vb6?

Trying To Get A Newline
I am using the shellexecute method to get the default mail client to open up a new message window. I've included the "TO" field, the "Subject" field, and the "body" field.

However, there's a problem with the body field. I can't get vbCrLf or chr(13) to work in it. Here's my code:


VB Code:
strbody = "Hi" & Chr(13) & "The library records show that you have issued the book number " & bookid & "." & Chr(13) & "I am in need of this book, so I request you to return it to the Library." & Chr(13) & Chr(13) & "Regards, " & Chr(13) & m_myuserid & Chr(13) strbookaction = "mailto:" & objrs.Fields(0).Value & "?subject=Request for Book&body=" & strbody ShellExecute hwnd, vbNullString, strbookaction, vbNullString, "C:", SW_SHOWNORMAL


Any suggestions?

Cannot Ignore Newline?
I'm having some issues when it cmes to reading a file and ignoring vbcrlf.
ii'm building a small intrepritive language type thing and it's not suposs to be line sensitive and it wont let me rid the Char as string of vbcrlf. I'm stumped.


Code:

' open above ...
Char = Input(1, FFile)
If Char = vbCrLf Then
Char = ""
End If
'close down here

Newline In String
I have a string with text which at some point I put in a textbox.
I want it to show on multiple lines in the textbox, but I want to decide where the newline should start when I put the text in the string, not when it's being put in the textbox. How would I do this? (Not sure, my question is clear, let me know if not)

Newline Using Msgbox
How do you create a new line of text when using the message box?

Newline Character
Hi,

I am adding a catalogue in my microsoft access database (in access itself, not via a 3rd party program).
The field 'description' holds all information regarding the item, but how do include a 'newline'-character in my description? Does
suffice ?
When I load the description in a textbox, the newline should work.

Thank you!

OsMo

Newline Character...
Hello again!

Does anyone know what the newline character is in VB?

For example, in C I could create a string "Hello
good morning" and the output would be

"Hello
good morning"

What is the VB equivalent of the
newline charcter?

Many thanks!

Mark-R

Newline At End Of Form
is there a way i can tell my form that if i'm doing something like
For y = 1000 To 1 Step -2
Print "b"
Next y

That when the line of "b"s reach the end of the form to goto the next line, but not to go down until it has reached the very end of the form... like so
_______________________
|bbbbbbbbbbbbbbbbbbbbbb|
|bbbbbbbbbbbbbbbbbbbbbb|
|bbbbbbbbbbbbbbbbbbbbbb|

Is There A Newline Character In Vb?
I have a textbox (txtReport). TxtReport is for display purposes only. I have a string (report) which is supposed to be one report on one line but I can’t get each report on a different line in the textbox.
I have tried using is “txtReport.SelText = report & Chr$(13)”
Does only one know a way to make this work? With or without the code above.
thanks

Newline In MsgBox()
Does anyone know how to go to a new line in a message box? I tried this but it doesnt work:

Ln1 = "Note: Line1"
NewLine = ""
Ln2 = "Note: Line2"
NoteMsg = MsgBox(Ln1 & NewLine & Ln2, vbOKOnly)

Copyright © 2005-08 www.BigResource.com, All rights reserved