C
cjobes
Hi all,
The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form
with:
Public WriteOnly Property DataSet() As DataSet
Set(ByVal Value As DataSet)
ResultGrid.DataSource = Value.Tables("tbSelect")
End Set
End Property
When the user clicks on a button "New Filter" the code below runs. On the
line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"
Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
Dim uSelect As String = "cindih"
ResultGrid.Visible = False
Dim strSearch As String = "user='" + uSelect + "'"
_dt = ResultGrid.DataSource
Dim tbTemp As DataTable
tbTemp = _dt.Clone()
Dim dRows() As DataRow = _dt.Select(strSearch, "")
Dim drSel As DataRow
For Each drSel In dRows
If Not drSel("hours") Is System.DBNull.Value Then
totHours = totHours + drSel("hours")
Else
drSel("hours") = 0
End If
tbTemp.ImportRow(drSel)
Next
ResultGrid.DataMember = "tbTemp"
ResultGrid.Visible = True
End Sub
What am I doing wrong here?
Thanks
Claus
The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form
with:
Public WriteOnly Property DataSet() As DataSet
Set(ByVal Value As DataSet)
ResultGrid.DataSource = Value.Tables("tbSelect")
End Set
End Property
When the user clicks on a button "New Filter" the code below runs. On the
line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"
Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
Dim uSelect As String = "cindih"
ResultGrid.Visible = False
Dim strSearch As String = "user='" + uSelect + "'"
_dt = ResultGrid.DataSource
Dim tbTemp As DataTable
tbTemp = _dt.Clone()
Dim dRows() As DataRow = _dt.Select(strSearch, "")
Dim drSel As DataRow
For Each drSel In dRows
If Not drSel("hours") Is System.DBNull.Value Then
totHours = totHours + drSel("hours")
Else
drSel("hours") = 0
End If
tbTemp.ImportRow(drSel)
Next
ResultGrid.DataMember = "tbTemp"
ResultGrid.Visible = True
End Sub
What am I doing wrong here?
Thanks
Claus