Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 1st, 2006, 08:05 AM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default drag and drop multiple controls at runtime

I want drag and drop the 3 textboxes at a time into a frame.

Thanks in Advance.
Ram Kishore.

 
Old November 1st, 2006, 12:42 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

At runtime?!? I'd like to hear more about that; what is it that you're doing?
 
Old November 1st, 2006, 06:50 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ahhhh. This is fun (if you are asking about doing this at runtime). You can actually do this... IF YOU DARE.

Basically, what you are really doing is changing the container for the control.
Each control has a container - usually the Form itself or a Frame (whose container is the form). But there are other container controls as well. For example, a Picture Box or various Tab controls.

So... for starters you can see the result of changing the container of a control thusly:
Code:
Set Text1.Container = Frame1
Of course, that is just the beginning - for example, it just places the control into the new container using the Top and Left properties relative to the new container. Now you need to write code that appropriately deals with dragging and positioning operations.

A simple test would be to set the dragmode property of the textbox to Automatic, and then place the above code in the Frame1_DragDrop event handler.

I am assuming VB6 here, by the way.

Have fun (if you can. This is going to be a lot of work.)

However... if you are asking about dragging and dropping 3 textboxes into a frame at the same time during design time, it can't really be done - as far as I know. You can move 3 textboxes from one container to another at the same time by selecting them, "cutting" them, and then pasting them into the new container, but I don't know of any way to drag and drop them.

Woody Z http://www.learntoprogramnow.com
 
Old November 1st, 2006, 07:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry I did not understand clearly.
You have three text boxes, and a frame, and you want to drag any one of them into the frame, and when dropped in the frame all the three text boxes must be moved into the frame, keeping their relative position. Or do you want to drag only one of the boxes per time?
 
Old November 1st, 2006, 07:49 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One or three... the basic steps are the same.

Woody Z http://www.learntoprogramnow.com
 
Old November 2nd, 2006, 12:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, but what I do not understand is if the original poster has troble dragging only one text box per time, or s/he knows how to do that, and just wants to know how to drag ALL of them at the same time... in these cases the answers will be different





Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop batott ASP.NET 2.0 Professional 3 April 26th, 2008 07:59 PM
Please Help me with Drag-n-Drop of multiple items vb_programmer Pro VB 6 9 October 7th, 2006 01:56 AM
Drag and drop vpinhao Beginning VB 6 0 September 11th, 2006 01:33 PM
Drag/Drop bmains Javascript 1 September 22nd, 2004 07:29 PM
drag and drop to multiple text boxes gbuller VB.NET 5 September 6th, 2004 09:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.