Hi
I have problem on dragging label
when the application show msgbox , it stop responding
I do n't know what is problem in my code :
dim l1 as label
Dim serverindex, serverP As Integer
Dim serverref As String
Dim copiedFragment As String
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
l1=new label()
l1.text="string"
AddHandler l1.MouseDown, AddressOf labelmouse_down
AddHandler l1.MouseMove, AddressOf labelmove
AddHandler Label11.DragEnter, AddressOf enter_server
End Sub
Sub enter_server( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.DragEventArgs)
Dim len As Integer = draggedlabel.IndexOf(":")
draggedlabel = draggedlabel.Substring(0, len)
serverP = serverindex
serverref = sender.text
If e.Data.GetDataPresent(DataFormats.Text) Then
paste(len, draggedlabel, True)
' move variable
If MsgBox("Do yo want to move " & draggedlabel & _
" from " & vbCrLf & server_names(serverP), MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
e.Effect = DragDropEffects.Copy
paste(len, draggedlabel, True)
Else
e.Effect = DragDropEffects.Move
paste(len, draggedlabel, False)
End If
Else
e.Effect = DragDropEffects.None
End If
end sub
Sub labelmouse_down( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs)
If (e.Button.Left) Then
mouse = True
' MsgBox(sender.text)
End If
End Sub
Sub labelmove( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs)
If mouse = True Then
sender.DoDragDrop(sender.text, DragDropEffects.Copy Or DragDropEffects.Move)
End If
draggedlabel = sender.text
' RemoveHandler Label1.MouseUp, AddressOf mouse_up
mouse = False
End Sub
Sub paste(ByVal len As Integer, ByVal copied_fragment As String, ByVal cut As Boolean)
msgbox(len.tostring & copied_fragment )
End Sub