Hi Thomas,
When you say TreeList do you mean the TreeView Control?
If that was the case, you don't need to do any work on the Excel side, just
handle the TreeView's ItemDrag event, in the event handler, call the
control's DoDragDrop method to start a drag & drop operation, once the item
is being dropped onto a cell, Excel will do its job to get the data you set
in the DoDragDrop method.
Sample code (suppose the TreeView control's name is tvData):
VB.NET
Private Sub tvData_ItemDrag(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ItemDragEventArgs) Handles tvData.ItemDrag
Dim item As TreeNode = TryCast(e.Item, TreeNode)
If (item IsNot Nothing) Then
tvData.DoDragDrop(item.Text, DragDropEffects.Copy)
End If
End Sub
C#
private void tvData_ItemDrag(System.Object sender, ItemDragEventArgs e)
{
TreeNode item = e.Item as TreeNode;
if (item != null)
{
tvData.DoDragDrop(item.Text, DragDropEffects.Copy);
}
}
You can also customize the data before sending it to the DoDragDrop method.
If you have any further questions regarding this issue, please feel free to
post here.
Regards,
Jie Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.