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 abstract classes and List the different characteristics of an abstract class?
What setting should be added in a configuration file to reject the particular user from accessing secured resources?
Name the latest features of the ADO.NET Entity Framework 4.0?
Write all names of public properties well-defined in the WebService class.
Which event controls are completely loaded?
Illustrate the benefit of option strict on? Describe in brief.
Differentiate between a ContextMenuStrip control and a MenuStrip control?
Write down the importance of delegates. Where must they be employed? Write down the conditions where we need them?
Illustrate some of the points regarding UserControl in WPF?
Elucidate the types of Authentication?
18,76,764
1935338 Asked
3,689
Active Tutors
1435243
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!