我陷入了困境。我是c#的新手,我刚刚将我的代码从vb.net转换为c#。 转换未处理的错误后发生。我不知道是什么原因。有人说Int32.Parse导致null异常,但Convert.ToInt32没有。
frmPointofSale pointofsale = new frmPointofSale();
this.btnOK.Enabled = true;
if (Convert.ToInt32(txtquantity.Text) < 1)
{
this.btnOK.Enabled = false;
}
else if (Convert.ToInt32(txtquantity.Text) > Convert.ToInt32(pointofsale.dgvList.CurrentRow.Cells[8].Value.ToString()))
{
btnOK.Enabled = false;
MessageBox.Show("not enough quantity!");
return;
}
TextBox3.Text = Convert.ToString(Convert.ToInt32(pointofsale.dgvList.CurrentRow.Cells[6].Value) * Convert.ToInt32(txtquantity.Text));
'else if'语句中发生错误。 请帮帮我。 TY