Drag and Drop - Passing Data (1 Viewer)

Adam Caramon

Registered User
Local time
Today, 15:02
Joined
Jan 23, 2008
Messages
822
Hi everyone,

I am starting to get into some Visual Basic that is above my head, so I am trying to figure some of this out. Hoping to get some help.

First, in layman's terms:
I have textbox1, textbox2, textbox3(and so on, up to 6), that contain numbers.
I have textbox7, textbox8, textbox9(and so on, up to 12) that are blank.

I want to drag numbers from textboxes 1-6 and drop their values, one-by-one into texboxes 7-12. I have been able to manage this without a problem.

When I drag a value from textbox 1-6 and drop it into textbox 7-12, I want to lock the textbox that a value was dragged from (1-6) so that it's value can no longer be dragged, and I want to lock the textbox that received the value (7-12) so it can no longer receive a drop.

I can manage locking the receiving textboxes by simply changing its AllowDrop property to False after it receives a value.

How do I manage the other part (make a textbox no longer dragable)?

Thanks in advance.
 
Hi everyone,

I am starting to get into some Visual Basic that is above my head, so I am trying to figure some of this out. Hoping to get some help.

First, in layman's terms:
I have textbox1, textbox2, textbox3(and so on, up to 6), that contain numbers.
I have textbox7, textbox8, textbox9(and so on, up to 12) that are blank.

I want to drag numbers from textboxes 1-6 and drop their values, one-by-one into texboxes 7-12. I have been able to manage this without a problem.

When I drag a value from textbox 1-6 and drop it into textbox 7-12, I want to lock the textbox that a value was dragged from (1-6) so that it's value can no longer be dragged, and I want to lock the textbox that received the value (7-12) so it can no longer receive a drop.

I can manage locking the receiving textboxes by simply changing its AllowDrop property to False after it receives a value.

How do I manage the other part (make a textbox no longer dragable)?

Thanks in advance.

This could be possible, and would require a little VB code to do it.
  1. In a Common Module, create a Global variable to store the name of the control to copy.
  2. In the On Click Event for the Control to copy FROM, set the Global Variable to identify the Control to copy FROM
  3. In the On Change Event for the Control to copy TO, set the properties of both the Control to copy FROM and the Control to copy TO so that no more changes are allowed.
 
You definitely put me on the right track. I declared a global variable, like you said. The On Click event didn't seem to work for this, so I tried to assign the global variable during the Mouse_Down event, and that worked. Then on the control receiving the drop I did a Select Case statement on the value held in the global variable, and disabled the control dragged from based on that value. Works like a charm.

Thanks very much.
 

Users who are viewing this thread

Back
Top Bottom