Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text box problem 1

Status
Not open for further replies.

sukumarsatyen

Technical User
Apr 4, 2010
4
IN
Hi,

looking for help regarding form text box.

when ever I type 3 lines in second text box, command button replaces the lines in second text box with any string in first text box.

in word application, after replacement, first line does not have space before it. second & third line does have.

please see attached file. please try to add 2-3 lines in second text box before clicking command button.

any solution to remove those spaces before second and third line?
 
I don't see leading space as you said, but take a look if you have any special software for language beside English turn on. I don't know why you use textbox.value instead of textbox.text, unless you want to do something not involve TEXT
 
Hi,

I guess I have not clearly defined my question. Also, attachment was confusing earlier.

Please read ahead.

In Word application, normally Ctrl + H will bring Replace Form on screen. This in-built form has a single line.

The form, which I am trying to prepare, has Multi-line property set true.

But, The output of TEXTBOX2 is quite different than its contents. This output contains leading spaces in second line (if input is given by user in TextBox2 as a second line). In other words, The second line of TextBox2 as an output at Word application contains leading spaces.

Is there any method to remove leading spaces from 2nd line of word application (not form)?

Please ignore above attachment and kindly help me on basis of below URL.
 
 http://www.mediafire.com/?yjjxyohcwza
I can see your attachment, but if the textbox is multi-line, then then these are paragraphs. The whole content is one string (multiple paragraphs). You can action paragraphs.

I am trying to understand your problem. You need to remove the spaces from the string that is the second paragraph?

Gerry
 
@ Gerry

You are right. I do not understand why it happens.

When I enter a multi-line text using enter key then there is no leading space before it. For example, lets compare these below lines.

I like emails.
I like emails.

You will find a leading space in second line. Lets assume that above example is an output on Word app through usage of my form (but in fact, it is reality).

Now, why this happens and what is solution for it.

I guess that Textbox1.value or Textbox1.text have Carriage return and a Line feed both when user enter any second line in Textbox2.

 
I am still trying to follow. I have a textbox with:

MultiLine = True
EnterKeyBehavior = True

If I enter:

I like emails.
I like emails.

into the texbox (that is, "I like emails." ENTER SPACE SPACE "I like emails.")

and execute (for a CommandButton):
Code:
Private Sub CommandButton1_Click()
Selection.TypeText TextBox1.Text
Unload Me
End Sub
that is exactly what I get.


The spaces are at the start of the second line. Which is exactly what I would expect. I am still not following what is happening for you. If I do NOT type the spaces, I do not get spaces. If I type spaces, I get spaces.

Are you saying you are NOT typing spaces:

"I like emails." ENTER "I like emails."

but ARE getting spaces anyway???
I guess that Textbox1.value or Textbox1.text have Carriage return and a Line feed both when user enter any second line in Textbox2.
Yes, and it should. That is what the EnterKeyBehavior = True does.

Gerry
 
It would be nice (and polite) if you actually answered the question.

Gerry
 

Yes, sukumarsatyen, nice for the rest of us who are observing this thread and want to understand exactly what you are observing, and polite to the guy who spent so much effort addressing your issue.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top