Re: Transferring an instance of an Object with OLEDragDrop
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Wed, 5 Oct 2005 18:53:40 -0700
"Noel" <vbgooglegroups@xxxxxxxxx> wrote in message
news:1128524180.662789.88960@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks for the response. I have gone with just transferring text.
>
> Some bad points
> - I need to create a Custom Format in order to transfer text, you would
> have thought this would be a common requirement
> - The datatype has to be transformed into a byte array, looks messy
> - You aren't guaranteed to get the exact data back from the byte array
> that you put into it
>
>From the help file on DataObject.GetData:
- - - - -
The settings for format are:
vbCFText 1 Text (.txt files)
vbCFBitmap 2 Bitmap (.bmp files)
vbCFMetafile 3 metafile (.wmf files)
vbCFEMetafile 14 Enhanced metafile (.emf files)
vbCFDIB 8 Device-independent bitmap (DIB)
vbCFPalette 9 Color palette
vbCFFiles 15 List of files
vbCFRTF -16639 Rich text format (.rtf files)
The SetData method requires the data to be in the form of a byte array when it
does not recognize the data format specified.
The GetData method always returns data in a byte array when it is in a format
that it doesn't recognize, although Visual Basic can transparently convert this
returned byte array into other data types, such as strings.
- - - - -
>From me:
The following sample illustrates transferring a string value between ordinary
listboxes:
Private Sub Form_Load()
List1.OLEDragMode = 1
List2.OLEDropMode = 1
List1.AddItem "item A"
List1.AddItem "Item 2"
List1.AddItem "item III"
End Sub
Private Sub List1_OLEStartDrag(Data As DataObject, _
AllowedEffects As Long)
If List1.ListIndex >= 0 Then
Call Data.SetData(List1.List(List1.ListIndex), vbCFText)
AllowedEffects = vbDropEffectCopy
End If
End Sub
Private Sub List2_OLEDragDrop(Data As DataObject, _
Effect As Long, Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Not Data Is Nothing Then
List2.AddItem Data.GetData(vbCFText)
End If
End Sub
.
- References:
- Transferring an instance of an Object with OLEDragDrop
- From: Noel
- Re: Transferring an instance of an Object with OLEDragDrop
- From: Steve Gerrard
- Re: Transferring an instance of an Object with OLEDragDrop
- From: Noel
- Transferring an instance of an Object with OLEDragDrop
- Prev by Date: Re: Add a logo to hard copy
- Next by Date: Deleteing Records
- Previous by thread: Re: Transferring an instance of an Object with OLEDragDrop
- Next by thread: Re: Hiding password in inputbox in vsb?
- Index(es):
Loading