Solved

How I append texts in a text box?

Posted on 2001-09-10
12
234 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 59
Reading the Contents of a Directory In Access VBA 5 68
Access query that references subform 5 47
Exit a vb6 apps when a calling it apps closes 15 46
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

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