Could someone tell me why I get the error "Operation failed:Index and lengt must refer to a location within the string Parameter:Length". It happened at this line: TheDataGridView.Rows[j].Cells[i].Value = tmpStr.Substring(0, 709);
tmpSize = g.MeasureString("Anything", tmpFont);
RowsHeight.Add(tmpSize.Height);
tmpSize = g.MeasureString(TheDataGridView.Rows[j].Cells[i].EditedFormattedValue.ToString(), tmpFont);
if (tmpSize.Width > 710)
{
string tmpStr = TheDataGridView.Rows[j].Cells[i].ToString();
TheDataGridView.Rows[j].Cells[i].Value = tmpStr.Substring(0, 709);
tmpSize = g.MeasureString(TheDataGridView.Rows[j].Cells[i].EditedFormattedValue.ToString(), tmpFont);
//tmpWidth = tmpSize.Width;
//MessageBox.Show(tmpStr);
//g.MeasureString(TheDataGridView.Rows[j].Cells[i]
}