Solved

How I append texts in a text box?

Posted on 2001-09-10
12
236 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

733 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