Private Sub ultraGrid1_DoubleClickHeader(sender As Object, e As Infragistics.Win.UltraWinGrid.DoubleClickHeaderEventArgs) Handles Me.ultraGrid1.DoubleClickHeader
' If the user double-clicked on the "lname" column in the "customers" band
' then copy a comma-separated list of all the last names in that column to
' the Windows clipboard.
'
If e.Header.Band.Key = "customers" And e.Header.Column.Key = "lname" Then
' If there are no rows then there is nothing to do.
'
If Me.ultraGrid1.Rows.Count = 0 Then
Return
End If
' Create a StringBuilder with roughly the initial capactity to hold all the last names.
'
Dim sb As New System.Text.StringBuilder(Me.ultraGrid1.Rows.Count * 8)
' Loop over all the rows in the first band and append each last name
' to the comma-separated list of values.
'
Dim row As UltraGridRow
For Each row In Me.ultraGrid1.Rows
sb.AppendFormat("{0}, ", row.Cells("lname").Text)
Next row
' Remove the final comma and space.
'
sb.Remove(sb.Length - 2, 2)
' Put the comma-separated list of last names on the clipboard.
'
Clipboard.SetDataObject(sb.ToString(), True)
End If
End Sub