Hello all,

I have a datagrid that I have coded to calculate fields by using code like this:

Code:
Me.DataGridView1.CurrentRow.Cells("Area").Value = _
        ((((Me.DataDataGridView1.CurrentRow.Cells("Diameter").Value) / 2) ^ 2) * 3.14)
Can someone help me write a try/catch (or something better) that will not have an error if the user leaves the "Diameter" field blank or accidentally types something other than a number?

I'd prefer if the field just stays blank and only calculates if there is a number typed into the field, otherwise show a message box if that's not possible.

Any help greatly appreciated!