| | |
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:
Solved Threads: 0
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
"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
Now try to learn how it works and solve your problem
> Place two label (Label1, Label2)
> Change DragMode Property of Label2 to 1 - Automatic
> And try the below code
VB Syntax (Toggle Plain Text)
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
KSG
•
•
Join Date: Aug 2008
Posts: 10
Reputation:
Solved Threads: 0
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.
> 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
•
•
Join Date: Aug 2008
Posts: 10
Reputation:
Solved Threads: 0
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
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.
Consider the Above coding
VB Syntax (Toggle Plain Text)
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.
VB Syntax (Toggle Plain Text)
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
KSG
•
•
Join Date: Aug 2008
Posts: 10
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Flash: Action Script (Graphics and Multimedia)
- I'm having problems (Java)
- CD Collection Almost there! (Java)
- GUI buttons Inventory Part 5 (Java)
- Resizing output window (Java)
- Problems with Directory.Move (C#)
- Combining a string To Label (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: I can't connect to a Modem!
- Next Thread: Purpose of WHERE 1=2" ?
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





