B
Booney440
Guest
C# winform textbox, I have a textbox and want to enter decimals like .2 or .7.
I keep getting System.FormatException: 'Input string was not in a correct format.
private void tb_Percentage_TextChanged(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewRow row = dataGridView1.Rows;
decimal d = Convert.ToDecimal(dataGridView1.Rows.Cells[31].Value);
// tb_Percentage.Text = string.Format("{0:C2}", Convert.ToInt32(tb_Percentage.Text));
decimal E = decimal.Parse(tb_Percentage.Text);
decimal f = d * E;
dataGridView1.Rows.Cells[32].Value = f.ToString("#.00");
}
}
Booney440
Continue reading...
I keep getting System.FormatException: 'Input string was not in a correct format.
private void tb_Percentage_TextChanged(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewRow row = dataGridView1.Rows;
decimal d = Convert.ToDecimal(dataGridView1.Rows.Cells[31].Value);
// tb_Percentage.Text = string.Format("{0:C2}", Convert.ToInt32(tb_Percentage.Text));
decimal E = decimal.Parse(tb_Percentage.Text);
decimal f = d * E;
dataGridView1.Rows.Cells[32].Value = f.ToString("#.00");
}
}
Booney440
Continue reading...