473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Inserting string at cursor position in textbox

Given

textBox1
string textBoxMsg
string Wrd

How do you insert Wrd in textBoxMsg at the cursor position in textBox1?

Thanks.
Nov 16 '05 #1
6 24126
Paddy wrote:
Given

textBox1
string textBoxMsg
string Wrd

How do you insert Wrd in textBoxMsg at the cursor position in textBox1?


Hi Paddy,

textBox1.SelectedText = Wrd;

Cheers

Arne Janning
Nov 16 '05 #2
On Tue, 1 Jun 2004 12:18:32 +0200, Paddy wrote:
Given

textBox1
string textBoxMsg
string Wrd

How do you insert Wrd in textBoxMsg at the cursor position in textBox1?

Thanks.


Hi,

first get the cursor position:
int nCursorPosition = textBox1.SelectionStart;

then insert the Wrd in textBoxMsg:
textBoxMsg = textBoxMsg.Insert (iCursorPosition, wrd);

And that's it.

Regards,
Peter
Nov 16 '05 #3
Hi Arne,

It works :)
Thank you.
Are you in nld?

Paddy.

"Arne Janning" <sp*****************@msn.com> wrote in message
news:Ot**************@TK2MSFTNGP11.phx.gbl...
Paddy wrote:
Given

textBox1
string textBoxMsg
string Wrd

How do you insert Wrd in textBoxMsg at the cursor position in textBox1?


Hi Paddy,

textBox1.SelectedText = Wrd;

Cheers

Arne Janning


Nov 16 '05 #4
Thank you Peter,
I see there are alternatives.
Best wishes,
Paddy.
"Peter Jausovec" <pe************@uni-mb.si> wrote in message
news:7o******************************@40tude.net.. .
On Tue, 1 Jun 2004 12:18:32 +0200, Paddy wrote:
Given

textBox1
string textBoxMsg
string Wrd

How do you insert Wrd in textBoxMsg at the cursor position in textBox1?

Thanks.


Hi,

first get the cursor position:
int nCursorPosition = textBox1.SelectionStart;

then insert the Wrd in textBoxMsg:
textBoxMsg = textBoxMsg.Insert (iCursorPosition, wrd);

And that's it.

Regards,
Peter

Nov 16 '05 #5
Paddy wrote:
Hi Arne,

It works :)
Thank you.
Are you in nld?


Heidelberg, Germany :-)

Cheers

Arne
Nov 16 '05 #6

"Arne Janning" wrote
Heidelberg, Germany :-)


"Paddy" wrote
< Groningen, Niederlande
< No pint of beer together then -:(

Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AP | last post by:
I am trying to find the integer value for the cursor position in a text box, in particular I want to find out if I am at the end of some text that I typed or at the beginning. I am using IE 6. ...
7
by: Steve | last post by:
does any one know a way to determine the position of the cursor in a text box. I would like to position a list next to the current position for context commands. I am using...
1
by: gal20 | last post by:
In my login page I have 2 textbox and one submit button. I also have a keypad for users to enter text to the textbox. I need the coding for backspace button that can be used for both textbox. The...
1
by: Matt Tapia | last post by:
Is there a way to insert text into a multi-row textbox where the cursor position is at in the multi-row textbox? Just wondering..I was told I could use the SelectedText property however I get...
3
by: Doug Bell | last post by:
Hi, How do I get the position of the cursor (as character position) when it is in a text box with no text selected? Thanks Doug
0
by: LProgrammer | last post by:
Hello! We are currently working on a PocketPC application in vb.net 2005. While working with the textbox control it is required that we get the exact cursor position. Cursor.Position The...
4
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end...
2
dj12345
by: dj12345 | last post by:
i have function to make character in lowercase if a text is in uppercase function upperCase(x) { try { var y=document.getElementById(x).value; ...
1
by: sypher04 | last post by:
Hi, new here as a member, but have visited frequently as a guest. I'm a C# developer from Canada. I primarily work on ASP.net and Pocket PC. I am currently in the process of writing a new mobile...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.