Solved

How I append texts in a text box?

Posted on 2001-09-10
12
235 Views
Last Modified: 2008-02-01
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
Comment
Question by:mitra_subhasis
  • 5
  • 2
  • 2
  • +3
12 Comments
 
LVL 1

Expert Comment

by:sanjeevjain1973
ID: 6473238
For append use like this

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

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

Sanjeev
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 10 total points
ID: 6473254
If you want the appended text to go on separate lines than try something like this:

Text1.Text = Text1.Text & vbCR & "New text"
0
 
LVL 1

Expert Comment

by:sanjeevjain1973
ID: 6473269
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6473295
sanjeevjain1973, trust me, vbCr works as advertised:
Text1.Text = Text1.Text & vbCr & "New text"
0
 
LVL 1

Expert Comment

by:harsh008_k
ID: 6473315
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
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6473790
Try this:

Text1.SelStart = Len(Text1.Text)
Text1.SelText = "Your Text"
0
 
LVL 12

Expert Comment

by:jgv
ID: 6474287
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6474415
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6474426
jgv,

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

Anthony
0
 

Author Comment

by:mitra_subhasis
ID: 6481518
Your answer is acceptable.
Subhasis.
0
 

Author Comment

by:mitra_subhasis
ID: 6481521
Your answer is acceptable.
Subhasis.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6482486
Totally un-deserved. Anthony
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question