Microsoft KB Archive/192209

= BUG: Cannot Do OLEDrag from a MultiColumn ListBox =

Article ID: 192209

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q192209



SYMPTOMS
After setting the Columns property of the ListBox to two or more columns, the OLEDragDrop functionality only works with data in the first column. This occurs with the OLEDragMode property set to Automatic.



RESOLUTION
Add the following statement in the MouseMove event of the ListBox: List1.OLEDrag Sample code is shown in the MORE INFORMATION section below.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new Standard EXE project in Visual Basic. Form1 is created by default. Add a ListBox, and a TextBox (use the default names) to Form1. Open the properties window for List1, and set the Columns property to 2.  Add the following code to the Form1 module: Private Sub Form_Load Dim i As Integer Text1.Text = "" '  List1.Columns = 2 ' Cannot be set to multicolumn at runtime List1.OLEDragMode = 1 Text1.OLEDropMode = 2 For i = 1 To 130 List1.AddItem Str$(i) Next i     End Sub  Save and run the Project. Try to drag a member of the first visible column to the TextBox. The result is that this data can be dragged from the ListBox and dropped in the TextBox.</li> Now attempt to drag a member of the second column into the TextBox. The result is that the item in the second row cannot be dragged.</li>  In order to work around the problem, return to design mode and add the following code to the MouseMove event of the ListBox: Private Sub List1_MouseMove(Button As Integer, Shift As Integer, _                 X As Single, Y As Single) If Button = 1 Then List1.OLEDrag End If     End Sub </li> Save and run the project again.</li> Attempt to drag items from either column. Items can now be dragged from both columns of the ListBox.</li></ol>

Additional query words: kbDSupport kbDSD kbVBp kbVBp600bug kbVBp500bug kbListBox

Keywords: kbbug kbpending KB192209

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.