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 concept of constructor?
What is the difference between Name Space and Assembly?
State the syntax used to declare the namespace in .NET?
What will happen if the ASP.NET server control with the event-handling routines is absent from its definition?
Explain the ToolTip control and how it can be associated with the other controls?
List the types of Cookies that are available in ASP.NET?
Illustrate the terms Authorization as well as Authentication?
Write main difference between classic ADO and ADO.NET?
State the difference between a class and a structure?
What is meant by the Runtime services?
18,76,764
1952324 Asked
3,689
Active Tutors
1447795
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!