Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

1 Kasım 2005 Salı

Moving Data by Dragging



'UserForm1

'AddTools on UserForm1: ListBox1, ListBox2, ComboBox1, TextBox1, Label1, Label2
Option Explicit
Dim TaşınanVeri As DataObject
Dim i As Single
Dim FareResmi As Integer

Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "[PBİD®]ListBox dan sürükleyerek veri taşımak..."
Application.Visible = False
For i = 1 To 24
ListBox1.AddItem "Kayıt " & (ListBox1.ListCount + 1)
Next i
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
On Error Resume Next
Application.Visible = True
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
On Error Resume Next
If Button = 1 Then
Set TaşınanVeri = New DataObject
TaşınanVeri.SetText ListBox1.Value
FareResmi = TaşınanVeri.StartDrag
End If
End Sub
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As Long, ByVal FareResmi As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As Long, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal FareResmi As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
ListBox2.AddItem Data.GetText
End Sub
Private Sub ComboBox1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
End Sub
Private Sub ComboBox1_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
ComboBox1.AddItem Data.GetText
ComboBox1.ListIndex = ComboBox1.LineCount - 1
End Sub
Private Sub TextBox1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
End Sub
Private Sub TextBox1_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
TextBox1.Value = Data.GetText
End Sub
Private Sub Label2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
End Sub
Private Sub Label2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
On Error Resume Next
Cancel = True
FareResmi = 1
Label2.Caption = Data.GetText
End Sub

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul