Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 113
  • Last Modified:

Drag And Drop Current Time into a textbook from a lable

I have a label that is displaying the current time on a windows form, I also have several textboxes that require the user to enter current time, they have the date/time format. I was wondering if it is possible to use drag and drop to put the time from the label into the textboxes

I am using Visual Studio 2013 Professional and this is a vb.net application
1 Solution
mickeyshelley1Author Commented:
Worked it out....
    Private Sub TxtReceived_DragDrop(sender As Object, e As DragEventArgs) Handles TxtReceived.DragDrop
        TxtReceived.Text = e.Data.GetData(DataFormats.Text).ToString

    End Sub

    Private Sub TxtReceived_DragEnter(sender As Object, e As DragEventArgs) Handles TxtReceived.DragEnter
        e.Effect = DragDropEffects.Copy
    End Sub

    Private Sub lblClock_MouseDown(sender As Object, e As MouseEventArgs) Handles lblClock.MouseDown
        If e.Button = MouseButtons.Left Then
            lblClock.DoDragDrop(lblClock.Text, DragDropEffects.Copy Or DragDropEffects.Move)
        End If

Open in new window


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now