User409696431 posted
The code you have:
If Not IsNothing(drwRow) Then
'-- already in datatable
MsgBox("Already in DataTable")
Exit Sub
Else
drwRow("RelDoc") = str1
dtbReldoc.Rows.Add(drwRow)
End If
is trying to assign a value to a row that is already "Nothing", and it does not have the schema of the datatable.
Create a new row for that datatable, and assign the value there. Try something like:
,,,
Else
Dim R As DataRow = dtbReldoc.NewRow
R("RelDoc") = str1
dtbReldoc.Rows.Add(R)
End If