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);
Elucidate the term Windows authentication?
State various controls of ASP.NET AJAX?
Briefly describe about XSLT?
What do you mean by the term Transport and Message Reliability?
Explain the function of a CustomValidator control?
Explain the role of a DISTINCT clause in the LINQ query?
Write the name of the class that manages event and layout of every ToolStrip elements?
Define the term Enumeration?
In what way we can format dates, numbers and currencies in the text box?
What setting should be added in a configuration file to reject the particular user from accessing secured resources?
18,76,764
1957784 Asked
3,689
Active Tutors
1436807
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!