Solved

VB 6 textbox select start

Posted on 2015-01-26
4
80 Views
Last Modified: 2015-01-26
I have a textbox that contains text and want to paste text after the text it contains with 1 space.
this does not work:
Private Sub txtDescription_Click()
txtDescription.SelStart = 0
txtDescription.SelText = Len(txtDescription.Text)
txtDescription.SelStart = Len(txtDescription.SelText) + 1
End Sub
what is wrong ?
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Guru Ji
ID: 40571007
You can do something like this to your text

txtDescription.SelText = Replace(txtDescription.Text, " ", "")


This will get rid of any space.
0
 

Author Comment

by:isnoend2001
ID: 40571025
No I want to add a space and  paste text to the end of the existing text
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 40571039
Why not just?

    txtDescription.Text = txtDescription.Text & " " & someStringVariable
0
 

Author Closing Comment

by:isnoend2001
ID: 40571071
Thanks this works:
someStringVariable needs to be the clipboard contents
txtDescription.Text = txtDescription.Text & " "
txtDescription.SelStart = Len(txtDescription.Text) + 1
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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

740 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