Cor,
my issue is actually not with the datagrid, but with
a chunk of code to represent the database on
a treeview control.
The datagrid stuff works fine. But since my treeview
must process child rows based on a relationship,
and getchildrows(rel_name) returns an array
of row objects, I think I need them sorted before
I execute the getchildrows command since once I
have run the command I have an array of
child rows and not a DV to sort. I only seem
to be able to sort a DV and yet the getchildrows
only works on a table in a dataset!
THis one's getting a bit tricky to solve.
Do you have any other ideas or pointers
that might be useful.
The code I am using to process the dataset and
load it into the treeview is below.
myDesignDS is my typed dataset object. DesignDataSet
is by typed class. It has three tables called Project,
Comment and Attachment. tvProjects is my TreeView.
Dim myProjectDR As DesignDataSet.ProjectRow
For Each myProjectDR In myDesignDS.Project.Rows
Dim ProjectNode As New TreeNode
ProjectNode.Text = myProjectDR.pProjectName
Dim myCommentDR As DesignDataSet.CommentRow
myDesignDS.Comment.DefaultView.Sort = "cDate DESC"
Dim myComments() As DesignDataSet.CommentRow
myComments =myProjectDR.GetChildRows("FK_Comment_Project")
For Each myCommentDR In myComments
Dim CommentNode As New TreeNode
CommentNode.Text =myCommentDR.dComment
Dim myAttach As DesignDataSet.AttachmentRow
Dim myAttachments() As DesignDataSet.AttachmentRow
myAttachments = myCommentDR.GetAttachmentRows
For Each myAttach In myAttachments
Dim myAttachNode As New TreeNode
myAttachNode.Text = myAttach.aName
CommentNode.Nodes.Add(myAttachNode)
Next
ProjectNode.Nodes.Add(CommentNode)
Next
tvProjects.Nodes.Add(ProjectNode)
Next
Once again, many thanks,
Jason.
On Sat, 17 Jul 2004 10:06:32 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Hi Jason,
I never use the defaultview however always the dataview, and before I try it
can you try it yourself with that, something as
Dim dv as new dataview(myDesignDs.tables("Comment")
or your strongly typed variant which I also not use
dv.sort = "cDate DESC"
mydatagrid1.datasource = dv
And when it still is not working add the row using
dv.AddRow
And when than still not
datagrid1.refresh
And when than still not show than some code.
:-)
Cor