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 Lazy Initialization?
Describe the role of new keyword in brief.
Write the name of event handlers which can be included in a Global.asax file?
How can height of a combo box drop-down list can be adjusted?
Define Web server controls as well as HTML?
Compare and contrast in brief the C# and Visual basic.NET?
Illustrate the term Marshalling?
State the function of the “Try-Catch-Finally” block
Write the difference between unmanaged and managed code?
Illustrate cross-page posting in an ASP.NET and the function of Server.Transfer() method?
18,76,764
1957570 Asked
3,689
Active Tutors
1440168
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!