先生,我在这些代码中得到了超出范围异常的索引,谁能解释我在哪里做错了
if (SelectedRowtt > -1)
{
dgvSItt.Rows[SelectedRowtt].Cells["Item_Code"].Value =txtItemCode.Text;
dgvSItt.Rows[SelectedRowtt].Cells["Description"].Value = txtDescription.Text;
dgvSItt.Rows[SelectedRowtt].Cells["Qty"].Value = Convert.ToDecimal(txtQty.Text).ToString(Program.gDigitsAfterDecimal);
dgvSItt.Rows[SelectedRowtt].Cells["UOM"].Value = Convert.ToDecimal(txtUOM.Text).ToString(Program.gDigitsAfterDecimal);
gvSItt.Rows[SelectedRowtt].Cells["Amount"].Value = Convert.ToDecimal(txtAmount.Text).ToString(Program.gDigitsAfterDecimal);
dgvSItt.Rows[SelectedRowtt].Cells["Discount"].Value = Convert.ToDecimal(txtRate.Text).ToString(Program.gDigitsAfterDecimal);
SelectedRowtt = -1;
}
else
{
IsDO = false;
dgvSItt.Rows.Add();
SelectedRowtt = -1;
}