Solved

Insert Text

Posted on 2007-03-27
4
244 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
  • 2
4 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 125 total points
Comment Utility
Hi thenrich;

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

Fernando
0
 
LVL 6

Expert Comment

by:riyazthad
Comment Utility
try this

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

Expert Comment

by:CodeFish
Comment Utility
Dim inStr As String = "This how"
        Dim modStr As String = " is"
        Dim endStr As String

        endStr = inStr.Insert(4, modStr)

Too Slow!
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now