This might be it, but the key value pairs in your dictionary are not correct.
The problem of your error is what Zoltan says.
if (GetDic.ContainsKey(e.KeyData.ToString()) || e.KeyCode == Keys.Enter || e.KeyCode == Keys.OemPeriod)
{
textBox1.Text = string.Empty;
startIndex += endIndex+1;
endIndex = 0;
}
else
{
endIndex++;
textBox1.Text = richTextBox1.Text.Substring(startIndex, endIndex);
}