This all worked until today when I turned on the option "strict" in the debugger.
I'm simply taking the text from a radio button on the form and entering it into the last column of the DGV. It's used as an identifier for that particular row's data source values.
I had to add the ".ToString" to get the blue line to go away in the code editor.
Another issue and I have a bunch just like this that are now broken...
The letter N in count has a red underline and the error is Object reference not set to an instance of an object.
I'm simply taking the text from a radio button on the form and entering it into the last column of the DGV. It's used as an identifier for that particular row's data source values.
I had to add the ".ToString" to get the blue line to go away in the code editor.
VB.NET:
For Each r As DataGridViewRow In DataGridView1.Rows
If r.IsNewRow Then Continue For
Dataanalysis.DGV1.Rows.Add({r.Cells(0).Value, r.Cells(1).Value, r.Cells(2).Value, r.Cells(3).Value})
Select Case True
Case Me.RBtnPort1.Checked
If r.Cells(10).Value.ToString = ("") Then[B]***BLOWS UP RIGHT HERE*** [[/B]Error Message:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
r.Cells(10).Value = Me.RBtnPort1.Text
End If
There are 5 more cases below this but they all do the same thing...just use .text from a different button.
Another issue and I have a bunch just like this that are now broken...
VB.NET:
Private Sub DataGridView1_CellValidated(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1.CellValidated
Dim vdiam = Val(Me.TextBox1.Text) ' Valve Diameter
Dim factor = vdiam * 3.14 ' the Cd Calculation
Dim count = Val(Me.TextBox7.Text) ' Number of valves
For Each r As DataGridViewRow In Me.DGV1.Rows
'Valve Coefficient formula = cfm / ((valve diameter * 3.14 * lift)*146) * number of valves
r.Cells(5).Value = CDbl(r.Cells(2).Value.ToString) / ((factor * CDbl(r.Cells(0).Value.ToString)) * 146) / count BLOWS UP ON THIS LINE....
The letter N in count has a red underline and the error is Object reference not set to an instance of an object.
Last edited: