I am trying to make it so that the user can move anyone of the 10 Label box called "lblmovebox" onto any one of the top ten blank label box called "lbldropbox". So they can pick up any one of the "lblmovebox" and drag it onto anyone of the top ten blank label
"lbldropbox. When they move the "lblmovebox" to the "lbldropbox" I want the Caption to show up in the blank label box lbldropbox.


Example:

The top 4 deadliest spiders

1 blank label...... banana spidwer
"lbldropbox"........ "lblmovebox"

2 blank label...... sydney funnell webb
"lbldropbox2"........... "lblmovebox2"

3 blank label...... wofl spider
"lbldropbox3"... "lblmovebox3"

4 blank label...... black widow
"lbldropbox4"... "lblmovebox4"

So if they think the wofl spider is #1 they just click on the "lblmovebox3" and it can be move to the "lbldropbox", and if they want to take the "lblmovebox3" and move it to "lbldropbox2" they can! After they are done I will add up the score with a cmd button and show them the top 4 deadliest spiders, and show them what they put!

Thanks for your time

I give example for drag and drop

> Place two label (Label1, Label2)
> Change DragMode Property of Label2 to 1 - Automatic
> And try the below code

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
   If TypeOf Source Is Label Then
      Label1.Caption = Source.Caption
   End If
End Sub

Now try to learn how it works and solve your problem

commented: Knows what he is talking about! +1

That's Just what I want! But I need to hide the Label2 after it has been moved! So when or how should I do the Label2.Visible=False? Only after they move it is when I want it to no show.

Yes, Change the Visible property to false to the source control after making the drag operation.

Thank You

Ok it was going good tell I tryed to put the 3 label in the the 1 label box, then it took the 2 label and the 3 label and puting them both in the label 1 box. So it looks like I need a bit more help! I need 7 Named labels that can be moved to any of the 7 blank labels in any order. I hope this makes sence! lol

Check the Caption of the Label
> If it is empty then perform the drag operation (that is Change the Caption)
> Otherwise Dont do the Drag Operation

OR

> Make Enabled Property of the Target Control (Label that receive DragDrop operation) to False.

These both prevent the multiple Drop operation for one Control.

I tryed doing the Make Enabled Property of the Target Control (Label that receive DragDrop operation) to False. It was still doing the same thing, I don't know how to do the line of code that well check the caption of the label and well change the captiion option do you have some code lines that could help me?

Make Enabled property of Target Control is working.
Consider the Above coding

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
   If TypeOf Source Is Label Then
      Label1.Caption = Source.Caption
      Label1.Enabled = False
   End If
End Sub

Or
Another possiblity you are having blank Labels as target. So if the label's caption is blank then only it receives drag drop event.

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
   
   If Label1.Caption = "" And TypeOf Source Is Label Then
      Label1.Caption = Source.Caption
   End If
End Sub

I figer out what I was doing wrong, I was trying to multiple code in the DragBox. lol

Ok I am useing the
Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
If Label1.Caption = "" And TypeOf Source Is Label Then
Label1.Caption = Source.Caption
End If
End Sub

How can I tell the code, after useing the Source to make the Source that was used to be Visible = False?

I am thinking of somthing like

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
If Label1.Caption = "" And TypeOf Source Is Label Then
Label1.Caption = Source.Caption
Then Source.Visible = False
End If
End Sub

But of course it wont let me! lol

It is correct, just change

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
   If Label1.Caption = "" And TypeOf Source Is Label Then
      Label1.Caption = Source.Caption
      Source.Visible = False
   End If
End Sub

You saved the day once more!! Thanks for all you help!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.