Results 1 to 4 of 4

Thread: GroupBox - DragDrop Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Philippines
    Posts
    218

    GroupBox - DragDrop Question

    hi guys,

    I tried to create a sime drag-drop on my group box but it seems not working at the moment. AllowDrop=True already. What's wrong on my code ?



    Code:
    Private Sub gb_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles gb.DragDrop
            Dim DropGB As GroupBox = CType((e.Data.GetData(GetType(GroupBox))), GroupBox)
            Me.gb.Controls.Add(DropGB)
        End Sub
    
        Private Sub gb_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles gb.DragEnter
            If e.Data.GetDataPresent(GetType(GroupBox)) Then
                e.Effect = DragDropEffects.Move
            Else
                e.Effect = DragDropEffects.None
            End If
        End Sub
    
        Private Sub gb_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gb.MouseDown
            Me.gb.DoDragDrop(Me.gb, DragDropEffects.All)
        End Sub
    Thank you.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: GroupBox - DragDrop Question

    How can you drag a GroupBox and drop it on itself? That doesn't make sense. What data are you trying to drag, where are you trying to drag it from and where are you trying to drop it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Philippines
    Posts
    218

    Re: GroupBox - DragDrop Question

    am just trying to drag the GB on the same form but different location.

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: GroupBox - DragDrop Question

    That wouldn't be a DragDrop operation. What you want to do is simply move the control. Search the forum for movable controls or similar search terms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width