DOCUMENT:Q192209 03-SEP-1998 [vbwin] TITLE :BUG: Cannot Do OLEDrag from a MultiColumn ListBox PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,6.0 OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 --------------------------------------------------------------------- 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. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Create a new Standard EXE project in Visual Basic. Form1 is created by default. 2. Add a ListBox, and a TextBox (use the default names) to Form1. 3. Open the properties window for List1, and set the Columns property to 2. 4. 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 5. Save and run the Project. 6. 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. 7. 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. 8. 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 9. Save and run the project again. 10. Attempt to drag items from either column. Items can now be dragged from both columns of the ListBox. Additional query words: kbDSupport kbDSD kbVBp kbVBp600bug kbVBp500bug kbListBox ====================================================================== Version : WINDOWS:5.0,6.0 Platform : WINDOWS Issue type : kbbug Solution Type : kbpending ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.