Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drang and Drop controls from one Container to another. 1

Status
Not open for further replies.

vikaskalra

Technical User
Aug 12, 2002
41
0
0
GB
Hi !

I need some help, one of the applications I am designing, requires me to have two containers. At the starting of the app the First container should contain some Labels/ Command buttons (say 5) in number.

The user can drag and drop any of these from the first container to the other. The user can change the order by draging and dropping the control within the second container itself. And to top this all, I need to dynamically show checkboxes against each control dropped in the second container.

Any help on this matter will be appreciated.
Thanks in advance,
Regards,
Vikas
 
a suggestion would be to create control arrays in each box, and as you drag drop (might have to simulate the dragdrop for some or all controls as well) just add a control element to the control array, display it and position it where the drop was (for absolute positioning). not sure if this is quite clear, and i am not very familiar with drag drop, but as far as i know you can't drag drop an actual control, someone correct me if i'm wrong :)
 
hi !

Thanks for replying. Tell me do you have any idea as to how to make a command button a part of a Container, I mean say an Image / Picture control etc is there, can you tell me how do I add a Command button to this container ?

Simply placing the command button inside a Container (Image / Picture) Control, won't make it a Container for the command button ? Am myself a bit confused about this, as to how to make one control a container for the other.

Merry Christmas [sunshine]

Vikas
 

To use this example program start a new project and place a picture box and a command button on the form (Picture1, Command1). Then paste the follow code in the code window ...
[tt]
Option Explicit

Private Sub Form_Load()
Picture1.Left = 0
Picture1.Top = 0
Picture1.Width = 2000
Picture1.Height = 2000
End Sub

Private Sub Command1_Click()
Set Command1.Container = Picture1
Command1.Left = 100
Command1.Top = 100
End Sub
[/tt]

Ok, so that is how you make a control a child of another control that can contain other controls. Then if you search this site for "Drag Drop" you will find several examples on how to do this. Including ...

thread222-501202
thread222-706687
thread222-676183 (follow the link in my post)

Good Luck


 
hey vb5prgrmr!!

That was some excellent stuff!!

It worked real cool... and for this you deserve a [medal]

Thanks a lot buddy !

Merry Christmas [sunshine]

Vikas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top