Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
Dim v As String
With Me.prgOne
If Not .SelectedGridItem Is Nothing Then
'There's a parent GridItem at the top of the hierarchy, which is not shown. Find that.
Dim f As GridItem = .SelectedGridItem
Do Until f.GridItemType = GridItemType.Root
f = f.Parent
Loop
For Each h As GridItem In f.GridItems
GridItemToString(v, h)
If h.GridItemType = GridItemType.Category Then
For Each h2 As GridItem In h.GridItems
GridItemToString(v, h2)
Next
v = v & vbCrLf
End If
Next
Clipboard.SetText(v)
Else
'only ever seems to be the case if the SelectedObject is Nothing, so not a problem.
End If
End With
End Sub
Private Sub GridItemToString(ByRef v As String, ByVal gi As GridItem)
With gi
v = v & .Label & vbTab
If Not .Value Is Nothing Then v = v & .Value.ToString
v = v & vbCrLf
End With
End Sub