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 Language Integrated Query (LINQ)?
What we can do to allot page specific attributes in the ASP.NET application?
What do you mean by Proxy and how to produce proxy for WCF Services?
Explain Custom User Controls in the ASP.NET?
What improvements are prepared in CAS in .NET 4.0?
Explain about the Take and Skip clauses?
Briefly describe about standard query operators in LINQ?
Specify the advantages of the DOM?
State the syntax used to declare the namespace in .NET?
Briefly describe the function of a CheckState property of a CheckBox control?
18,76,764
1960487 Asked
3,689
Active Tutors
1415505
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!