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);
Distinguish between toolstrip drop-down button and toolstrip split button?
Write down a short note regarding the .NET?
What are the enrichment in the ClickOnce deployment in the .NET 4.0?
Write the syntax of the for loop in C# code?
Write the name of namespaces which are required to allow the use of the databases in the ASP.NET pages?
Name the root namespace which is used for fundamental types in .NET Framework?
Describe code contracts?
Distinguish between read-only and constants variables which is used in the programs?
Describe the appSettings Section which contains in a web.config file?
List the types of Cookies that are available in ASP.NET?
18,76,764
1951708 Asked
3,689
Active Tutors
1454339
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!