Help With Moving Label For The User?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Help With Moving Label For The User?

 
0
  #1
Aug 1st, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 513
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Help With Moving Label For The User?

 
1
  #2
Aug 2nd, 2008
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
  1. Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
  2. If TypeOf Source Is Label Then
  3. Label1.Caption = Source.Caption
  4. End If
  5. End Sub

Now try to learn how it works and solve your problem
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Re: Help With Moving Label For The User?

 
0
  #3
Aug 3rd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 513
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Help With Moving Label For The User?

 
0
  #4
Aug 3rd, 2008
Yes, Change the Visible property to false to the source control after making the drag operation.
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Re: Help With Moving Label For The User?

 
0
  #5
Aug 3rd, 2008
Thank You
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Re: Help With Moving Label For The User?

 
0
  #6
Aug 3rd, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 513
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Help With Moving Label For The User?

 
0
  #7
Aug 3rd, 2008
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.
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Re: Help With Moving Label For The User?

 
0
  #8
Aug 4th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 513
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Help With Moving Label For The User?

 
0
  #9
Aug 4th, 2008
Make Enabled property of Target Control is working.
Consider the Above coding
  1. Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
  2. If TypeOf Source Is Label Then
  3. Label1.Caption = Source.Caption
  4. Label1.Enabled = False
  5. End If
  6. 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.

  1. Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
  2.  
  3. If Label1.Caption = "" And TypeOf Source Is Label Then
  4. Label1.Caption = Source.Caption
  5. End If
  6. End Sub
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 10
Reputation: troblekid is an unknown quantity at this point 
Solved Threads: 0
troblekid troblekid is offline Offline
Newbie Poster

Re: Help With Moving Label For The User?

 
0
  #10
Aug 4th, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC