The information in this article applies to:
- Microsoft Visual Basic Learning, Professional, and Enterprise Editions
for Windows, version 5.0
SYMPTOMS
A listbox control is set to more than one column and the OLEDragMode
property is set to Automatic to allow for OLE Drag-and-Drop. When you
attempt to drag an item to another control from any column of the listbox
other than the first, the item is not copied to the target control as
expected.
RESOLUTION
To work around this problem, initiate the drag from the listbox using the
OLEDrag method.
For example, you would add code such as the following to the MouseDown
event of the "multi-column" listbox:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
List1.OLEDrag
End Sub
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products
listed at the beginning of this article. We are researching this
bug and will post new information here in the Microsoft Knowledge
Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
- Start a new Standard EXE project in Visual Basic. Form1 is created by
default.
- Add the following controls to Form1 and set the following properties for
the appropriate controls:
Control Default Name Property Setting
---------------------------------------------------------------
Text Box Text1 Text <Blank>
OLEDropMode 2 - Automatic
List Box List1 Columns 2
OLEDragMode 1 - Automatic
- Copy the following code to the Module of Form1:
Option Explicit
Private Sub Form_Load()
Dim intCounter As Integer
' Add some test data to the ListBox
For intCounter = 1 To 100
List1.AddItem CStr(intCounter)
Next
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
' Uncomment the next line for a simple workaround.
'List1.OLEDrag
End Sub
- On the Run menu, click Start or press the F5 key to start the program.
Select an item from the first column and drag that item to the text box.
Note that you must Click and release to select the item, then Click-and-
Drag the same item as a second operation. Now, select an item from the
second column and drag that item to the text box.
Result: Note that the item from the first column is copied to the text
box, but the item from the second column is not.
- Choose End from the Run Menu or Click the End button to stop the
program. Uncomment the workaround line and repeat step 4.
Result: Note that both items are now successfully copied to the text
box. Also, it no longer requires a Click to select and a second Click-
and-Drag to move the item. This can now be a single Click-and-Drag
operation.
Keywords : vb5all
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbpending