943,844 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Aug 1st, 2008
0

Help With Moving Label For The User?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008
Aug 2nd, 2008
1

Re: Help With Moving Label For The User?

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
VB Syntax (Toggle Plain Text)
  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
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Aug 3rd, 2008
0

Re: Help With Moving Label For The User?

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008
Aug 3rd, 2008
-1

Re: Help With Moving Label For The User?

Yes, Change the Visible property to false to the source control after making the drag operation.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Aug 3rd, 2008
0

Re: Help With Moving Label For The User?

Thank You
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008
Aug 3rd, 2008
0

Re: Help With Moving Label For The User?

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008
Aug 3rd, 2008
0

Re: Help With Moving Label For The User?

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.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Aug 4th, 2008
0

Re: Help With Moving Label For The User?

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008
Aug 4th, 2008
0

Re: Help With Moving Label For The User?

Make Enabled property of Target Control is working.
Consider the Above coding
VB Syntax (Toggle Plain Text)
  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.

VB Syntax (Toggle Plain Text)
  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
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Aug 4th, 2008
0

Re: Help With Moving Label For The User?

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
troblekid is offline Offline
10 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: I can't connect to a Modem!
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Purpose of WHERE 1=2" ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC