good evening....
i have a problem...
ie.
i wrote a code in gridveiw_cell validating event..like below
private void gridStoreIssues_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
try
{
if (e.RowIndex != -1 && e.ColumnIndex == colIsuQty.Index && ((StoreTransaction)gridStoreIssues.Rows[e.RowIndex].DataBoundItem) != null)
{
if (colIndQty.Visible && Convert.ToSingle(e.FormattedValue) > Convert.ToSingle(gridStoreIssues[colIndQty.Index, e.RowIndex].Value))
{
Console.Beep();
e.Cancel = true;
MessageBox.Show("Issue Qty Cannot Exceed Indent Qty");
StatusBar.Text = "Issue Qty Cannot Exceed Indent Qty";
gridStoreIssues.CurrentCell = gridStoreIssues[colIsuQty.Index, e.RowIndex];
gridStoreIssues.BeginEdit(true);
}
else if (Math.Round(Convert.ToSingle(e.FormattedValue), 3) > Math.Round(((StoreTransaction)gridStoreIssues.Rows[e.RowIndex].DataBoundItem).QuantityOnHand, 3))
{
Console.Beep();
DialogResult dr = MessageBox.Show(string.Format("The Issued qty is over the available qty of {0:N3}.", Math.Round(((StoreTransaction)gridStoreIssues.Rows[e.RowIndex].DataBoundItem).QuantityOnHand, 3)), "Continue", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (dr == DialogResult.OK)
{
e.Cancel = true;
gridStoreIssues.BeginEdit(true);
}
else
e.Cancel = false;
}
}
}
catch (Exception ex)
{
}
}
its working fine in my system..
but in my clint system give a exception like bellow
16:31:08,StoreIssueForm,StoreIssueForm,Input string was not in a correct format., at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Convert.ToSingle(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToSingle(IFormatProvider provider)
at System.Convert.ToSingle(Object value)
at Prosynergix.Store.StoreIssueForm.gridStoreIssues_CellValidating(Object sender, DataGridViewCellValidatingEventArgs e)
i dont know why it was gave exception...
any one plz help me...