A toi de faire un truc plus joli !
Je n'aime jamais les méthodes ou il faut determiner le type d'un objet puis faire des select case ou des if sur ce type. Ca ne fait jamais très "objet".
Dans mes softs j'utilise ça comme code pour les copier/coller. Ca ne resoudra pas ton pb mais bon ca permet de faire des copier/coller sur tout les champs. (Il faut adpater le coller car dans le cas présent il colle des doubes); En plus il faudrait l'apdapter à HB2 en utilisant les exceptions.
CODE
private const clipboardText as Integer =0
Public Const sysTrapClipboardAddItem As Long = &HA10A
Public Const sysTrapClipboardAppendItem As Long = &HA370
Public Const sysTrapClipboardGetItem as Long = &HA10C
'Buffer Memory Handle locking / unlocking functions
Public Declare Function MemHandleLock(ByVal hMem as Long) as Pointer Trap &HA021
Public Declare Sub MemHandleUnlock(ByVal hMem as Long) Trap &HA022
Public Declare Sub MemMoveToString(ByRef sString As String, ByVal lPointer As Long, ByVal lSize As Long) Trap &HA026
'Clipboard functions
Public Declare Sub ClipboardAddItem(byval ClipboardFormatType as Integer, byval sm as StreamMemory, byval length as Integer) Trap sysTrapClipboardAddItem
Public Declare Function ClipboardGetItem (byval ClipboardFormatType as Integer, byref length as Integer) as Pointer Trap sysTrapClipboardGetItem
Public Declare Function ClipboardAppendItem (byval ClipboardFormatType as Integer, byval sm as StreamMemory, byval length as Integer) as Integer Trap sysTrapClipboardAppendItem
public Sub ToClipboard(ByVal data as String)
Dim s as new StreamMemory
write s,data
ClipBoardAddItem clipBoardText,s,Len(data)
End Sub
public Sub FromClipboard(ByRef data as String)
dim n as Integer
dim h as long
Dim MyPtr as Long
h=ClipboardGetItem(0,n)
If n=0 then
data = "0"
Else
'Lock the ressource
MyPtr=MemHandleLock(h)
'allocate the string
data=space(n)
'copy the string
MemMoveToString data,MyPtr,n
'unlock the ressource
MemHandleUnlock h
End if
on error Goto erreurPaste
data = CDbl(Data)
exit sub
erreurPaste:
data = "0"
End Sub