• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

How I append texts in a text box?

Suppose, I have a text box, say Text1 and whose 'MULTILINE' property is set 'TRUE'. Is there any method in the Text Box class which can be used to append texts in the Text Box object Text1.

Subhasis.
0
mitra_subhasis
Asked:
mitra_subhasis
  • 5
  • 2
  • 2
  • +3
1 Solution
 
sanjeevjain1973Commented:
For append use like this

Text1.Text = Text1.Text & "Apended Text"

Means u can concate & old value of text the aggain assign.

Sanjeev
0
 
Anthony PerkinsCommented:
If you want the appended text to go on separate lines than try something like this:

Text1.Text = Text1.Text & vbCR & "New text"
0
 
sanjeevjain1973Commented:
vbCrLf is combination carrige return & Linefeed
means Chr(13) + Chr(10) . SO If you want appended text start by next line then Use VbCrLf constant or chr13)& char(10).

Sanjeev
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Anthony PerkinsCommented:
sanjeevjain1973, trust me, vbCr works as advertised:
Text1.Text = Text1.Text & vbCr & "New text"
0
 
harsh008_kCommented:
To append some text into textbox

1)U can use &
   a)Text1.Text=Text1.Text & "your text"
   b)with space
      Text1.Text=Text1.Text & ""  & "Your text"
2) a)Text1.Text=Text1.Text+"Your Text"
   b)Text1.Text=Text1.Text + "" + "Your Text"    
0
 
Valliappan ANSenior Tech ConsultantCommented:
Try this:

Text1.SelStart = Len(Text1.Text)
Text1.SelText = "Your Text"
0
 
jgvCommented:
acperkins,

Text1.Text = Text1.Text & vbCr & "New text"

Textbox with MultiLine=True will visibly print the carrige return character using the above method. To move to a new line I've always used vbCrLf. What are you doing to get the vbCr to work?
0
 
Anthony PerkinsCommented:
jgv,

I must have been doing drugs or imagined it! So much for arrogance.

Curiously with a VB5 IDE I get the same (except 2 visible symbols) with:

Text1.Text = Text1.Text & vbCrLf & "New Text"

Who knows,

Anthony
0
 
Anthony PerkinsCommented:
jgv,

Never mind the last post. You are right, I had not set the MultiLine property on. duh!

Anthony
0
 
mitra_subhasisAuthor Commented:
Your answer is acceptable.
Subhasis.
0
 
mitra_subhasisAuthor Commented:
Your answer is acceptable.
Subhasis.
0
 
Anthony PerkinsCommented:
Totally un-deserved. Anthony
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now