G
Guest
Can someone please explain why I get a different result when using the
GetLineFromCharIndex method on the last char in the Text property and the
Lines.Length property?
MainForm_gedcomTextBox is a RichTextBox.
For example this code:
private void End_menuItem_Click(object sender, System.EventArgs e)
{
int lastLine = MainForm_gedcomTextBox.GetLineFromCharIndex
(MainForm_gedcomTextBox.Text.Length -1);
string one =
MainForm_gedcomTextBox.Text.Substring(MainForm_gedcomTextBox.Text.Length-6);
string two =
MainForm_gedcomTextBox.Lines[MainForm_gedcomTextBox.Lines.Length-1];
MainForm_gedcomTextBox.SelectLine(MainForm_gedcomTextBox.Lines.Length-1);
}
produced:
lastLine = 144352
one = "0 TRLR"
two = "0 TRLR"
MainForm_gedcomTextBox.Lines.Length = 144082
GetLineFromCharIndex method on the last char in the Text property and the
Lines.Length property?
MainForm_gedcomTextBox is a RichTextBox.
For example this code:
private void End_menuItem_Click(object sender, System.EventArgs e)
{
int lastLine = MainForm_gedcomTextBox.GetLineFromCharIndex
(MainForm_gedcomTextBox.Text.Length -1);
string one =
MainForm_gedcomTextBox.Text.Substring(MainForm_gedcomTextBox.Text.Length-6);
string two =
MainForm_gedcomTextBox.Lines[MainForm_gedcomTextBox.Lines.Length-1];
MainForm_gedcomTextBox.SelectLine(MainForm_gedcomTextBox.Lines.Length-1);
}
produced:
lastLine = 144352
one = "0 TRLR"
two = "0 TRLR"
MainForm_gedcomTextBox.Lines.Length = 144082