Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Insert Text

Posted on 2007-03-27
4
Medium Priority
?
255 Views
Last Modified: 2010-04-23
How can I insert a peace of text into a text box at the current cursor location vs. apending to the end of the text string?
0
Comment
Question by:thenrich
[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 64

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 18801455
Hi thenrich;

        Dim insertThisText As String = " Hello World "
        TextBox1.Text = TextBox1.Text.Insert(TextBox1.SelectionStart, insertThisText)

Fernando
0
 
LVL 6

Expert Comment

by:riyazthad
ID: 18801469
try this

TextBox1.Text = TextBox1.Text.Substring(0, TextBox1.SelectionStart) & "Add " & TextBox1.Text.Substring(TextBox1.SelectionStart)
0
 
LVL 6

Expert Comment

by:CodeFish
ID: 18801476
Dim inStr As String = "This how"
        Dim modStr As String = " is"
        Dim endStr As String

        endStr = inStr.Insert(4, modStr)

Too Slow!
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18801489
Hi thenrich;

The above code will insert text into TextBox1 where the text insertion point is in the text box, not where the cursor is. So you will need to click to set the insertion point..

Fernando
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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