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);
Is it possible to create a Windows Service by using WPF?
Illustrate Queues and Stacks?
Write down the classes which derive from the abstract System.Windows.Shapes.Shape class in the WPF?
Explain the use of the PlaceHolder control? Is it possible to see it at runtime?
State the purpose of DataView?
Specify the pre-requisites for connection pooling?
Is it possible to post and access view state in the other application?
What are validation controls? How many validation controls are present in ASP.NET 4.0?
Explain the difference between the global theme and the page theme?
State the method which can be used to impose Garbage collection in .NET?
18,76,764
1951254 Asked
3,689
Active Tutors
1437606
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!