SetData method

riekertv

Member
Joined
Aug 23, 2005
Messages
7
Programming Experience
3-5
Hi all,

I have a treenode, or listitem, in a modular object variable. I'm trying to set the object variable as the event's "dropdata" in the dragdrop event procedure.

I'm calling the setdata method, but it keeps telling me that "Object reference not set to an instance..."

When the event is fired, the object variable does contain the listitem, or node, and i do cast it before trying to setdata. Neither of the setdata methods below work.
VB.NET:
If e Is Nothing And TypeOf m_cutItem Is ListViewItem Then
    e.Data.SetData("System.Windows.Forms.ListViewItem", True, _
    CType(m_cutItem, ListViewItem))
Else
    e.Data.SetData(CType(m_cutItem, TreeNode))
End If
 
Last edited by a moderator:
Back
Top