Place a cursor on given line-character in C sharp
How can we programmatically place a cursor on the given line or on the character in a RichTextBox control in the C#?
Expert
RichTextBox control has Lines array property that demonstrates one item of the array in separate line. Every line entry has a Length property that can be used to exactly position the cursor at the character, which is shown in the following code:
private void GoToLineAndColumn(RichTextBox RTB, int Line, int Column)
{
int offset = 0;
for(int i = 0; i < Line -1 && i < RTB.Lines.Length; i++)
offset += RTB.Lines[i].Length + 1;
}
RTB.Focus();
RTB.Select(offset + Column, 0);
What are public and private cloud?
What are Binders ?
List different ways of deployment that are supported by .NET.
State the properties in C# and the advantages that are obtained by using them in programs.
Explain the use of Windows Installer.
Explain the function of .WebPart file do?
What is the difference between Name Space and Assembly?
What is meant by Manifest?
Write down the importance of delegates. Where must they be employed? Write down the conditions where we need them?
What do you mean by the XOML files?
18,76,764
1950797 Asked
3,689
Active Tutors
1436112
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!