In my datagridview I have 3 columns, lets say Column1, 2, 3. Problem I have is I'm trying to prevent an error if the user types "0" into Column 2 or 3. I tried message boxes and it is a pain because they pop up when you make a new row and I just think they are annoying.
I can prevent against it dividing by null or a letter by the following codes: i don't think you need to handle this issue this way i would like to say (1) you cross check numeric values (2) you cross check null entries, i mean "" then come to division part. I can get it to work most of the time using ISDBNULL or ISNUMERIC but some zeros still slip through and saying =0 or Unfortunately adding and editing within a Data Grid View is possible in short as you have learned already things get messy fast.
Thanks You can handle dealing with not allowing zero in Cell Validating event of the Data Grid View. Data Grid View Cell Validating Event Args) _ Handles Data Grid View1.
Design, Version=126.96.36.199, Culture=neutral, Public Key Token=b03f5f7f11d50a3a", typeof(System.
Design, Version=188.8.131.52, Culture=neutral, Public Key Token=b03f5f7f11d50a3a", "System.
Virtual mode requires the implementation of a data cache from which the Data Grid View control is populated.
Virtual Mode property to true to display a subset of the available data.
Text) End Select End If End Sub Function Number Cleaner(By Val str As String) As String Dim Value As String = System. Col3 is a calculated date of user entered textbox date Col2 (you helped me with this one). Col5 is an area calculation based off diameter entered in Col4. Col7 is calculation of PSI which is Col6 divided by Col5. Preferably I'd like the grid to only calculate if there is a number in the applicable text boxes, otherwise it ignores the calculation and you can type anything in a cell - letters, zeros, leave it blank, it don't matter.