My code works in debug mode, but in release mode I get a System NullReference Exception for the MTable
in line 6 and I don't know the reason. In debug mode I have access to the data.
Dim myregex As Regex = New Regex("A[1-6]|A[A-M]")
Dim MTable As New DataTable
Dim dvr As New System.Windows.Forms.DataGridViewRow
If datasetB.Tables.Contains("BLA") Then
MTable = datasetB.Tables("BLA").Select().
Where(Function(r) myregex.IsMatch(r.Item("Data"))).ToArray().CopyToDataTable
MTable.Columns.Add(New DataColumn("textt", GetType(String)))
MTable.Columns.Add(New DataColumn("texttt", GetType(String)))
MTable.Columns.Add(New DataColumn("textttt", GetType(String)))
MTable.Columns.Add(New DataColumn("texttttt", GetType(String)))
ErrorsDgV.DataSource = MTable
For Each dvr In Me.ErrorsDgV.Rows
If dvr.Cells(5).Value IsNot Nothing Then
'do some things
End If
Next
Else
MsgBox("didn't work")
End If
Thanks in advance!