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);
Write down some of the benefits of XAML?
Explain the use of a CommandBuilder class?
Write the use of MaxDate and MinDate properties of a MonthCalender control?
Name the parameters which control generally connection pooling behaviours?
How to ensure that no one has interfered with ViewState in the Web page?
State the syntax used to declare the namespace in .NET?
How docking is different from anchoring?
Explain what do you mean by .NET?
List the usages of Command object in ADO.NET?
State the major difference between the sub-procedure and function?
18,76,764
1941912 Asked
3,689
Active Tutors
1442857
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!