473,385 Members | 1,798 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,385 software developers and data experts.

Moving the caret in a multiline RichTextBox

Hello,

I'm trying to implement a backspace on the "bottom" line of a multiline text
box. I want it to be ignored if it's already at the beginning of that line.
I think I've got the part about removing each character from the string that
represents that line, but how do I back up the caret? I understand .NET 3.0
has implemented a method for doing backspaces, but I'd like to know how to do
it manually since not many people around here have installed 3.0.

Thanks,
Ray
May 30 '07 #1
2 1960
Ray - Try using the Select method of the textbox with the new starting
position and a length of 0. That should do the trick.

--
Gregg Walker
May 31 '07 #2
Sorry I left this out. Additionally you will probably want to call
ScrollToCaret after calling Select. This will bring the caret into view if
your scroll bars are in use.

Example...

int newPos;

.... backspace logic

newPos = p;

text1.Select(p, 0);
text1.ScrollToCaret();

Hope that helps.

--
Gregg Walker
May 31 '07 #3

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

Similar topics

1
by: Rocketman | last post by:
I am trying to find out when i reach the next line when multiline is switched on and i DON'T PRESS ENTER TO GO TO THE NEXT LINE(lines method is there for that purpose). Is there any other method i...
2
by: Sean | last post by:
Hi, I have an application that will pop up a listboxwindow (containing words that users can choose from) when I type certain characters on a richtextbox. Now I have a problem of maintaining...
0
by: Sean | last post by:
Hi, I have an application that will pop up a listboxwindow (containing words that users can choose from) when I type certain characters on a richtextbox. Now I have a problem of maintaining...
0
by: James dean | last post by:
In this program i set the RichTextBox property SelectionStart in order to move the caret(cursor) onto the next character. I have a loop to do this but unfortunately this is very slow. How would i...
1
by: Michael Tanner | last post by:
I have a multiline text box. I would like some of the text to be one font color and other text another font color. Is this possible with a multiline text box?
2
by: DaveR | last post by:
Can anybody help me to a)get the user's cursor insertion point (caret) from a multiline textbox, using client-side script I suppose, and then b)return the position to VB code behind? I have...
2
by: randy | last post by:
Hi, I'm trying to set up a richtextbox to behave like the text area in a web browser, i.e. no caret, and a cursor that changes depending on what it's hovering over. I've been setting the...
0
by: Udi | last post by:
Hi, I have derived my ConsoleTextBox from RichTextBox. I'm trying to implement a console-like text box with history capabilities. My problem is that when I'm trying to append a command, I can't...
4
by: Jeannot | last post by:
VS2008, VB, .NET 3.5 When I create a TextBox in Designer, then at runtime wherever I click, the caret is placed at the end of the text the box actually contains. But when I create a TextBox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.