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);
Explain different implementations of the LINQ?
State the relationship between Class and an Object?
What do you mean by the term base class of .net?
By how many ways you can instantiate a tuple?
What we can do to allot page specific attributes in the ASP.NET application?
What do you mean by the Extender controls?
How can a text box be enforced to show characters in the uppercase?
How can CAS be turn-on and turn-off?
Differentiate between authorization and authentication?
Differentiate between the ASP.NET session and a ASP session?
18,76,764
1924518 Asked
3,689
Active Tutors
1452388
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!