|
-
March 28th, 2003, 04:49 AM
#1
How can I insert a string in target cursor?
Hi, everybody..
How can I insert a text into a string randomly...
e.g. there a string "Hello, Friend" in the textbox.
If I move a cursor within "Hello," and "Friend",
can I insert a text "Dear" immediately within the string?
How to do that? any function can get the cursor position within a String????
Thanks for your help.
-
March 28th, 2003, 12:54 PM
#2
for example you can use Insert, take the IndexOf etc..
string has lots of methods in it.
string s = "Hello, Friend";
s = s.Insert(6,"Dear");
MessageBox.Show(s);
Paresh
- Software Architect
-
March 28th, 2003, 08:09 PM
#3
Thank you Paresh,
Actaully, I know this insert method,
But I want to know where is the cursor position within the string, so that I can use .insert(position,string)....
hikki
-
March 28th, 2003, 09:06 PM
#4
If you want the position of the caret in the textbox... try
textBox1.SelectionStart
That which does not kill us, only makes us stronger.
MCSD .NET
-
March 28th, 2003, 09:13 PM
#5
oh good...
unbelievable !!
Thanks a lot... wolfofthenorth.
-
March 28th, 2003, 09:22 PM
#6
Glad I could help.
That which does not kill us, only makes us stronger.
MCSD .NET
-
March 31st, 2003, 11:31 AM
#7
you will need to look more in Richtextbox, the members are sufficient for your basic needs of selection and insertion.
you will also need to look in string members and methods.
Paresh
- Software Architect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|