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);
State the use of the Select clause and SelectMany() method in LINQ?
Briefly explain about Web server controls in ASP.NET?
Illustrate the benefit of option strict on? Describe in brief.
Explain the syntax of the “for” loop.
Write the difference between the Procedural and Object-oriented programming?
Specify the syntax which is be used to inherit from a class in C#?
Explain the use of Copy Project command?
Name the parameters which control generally connection pooling behaviours?
State the two most important categories which distinctly categorize variables of C# programs.
Illustrate the difference between the .dll extension and .exe extension files?
18,76,764
1959555 Asked
3,689
Active Tutors
1438274
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!