Help with Index out the bound of the Array issue.

  • Thread starter Thread starter Manuel Canas
  • Start date Start date
M

Manuel Canas

Hi There,

I have been batleing with this now that I'm at the end of my rop here.
What I'm doing here is this;
1 - retrieving some data from the database with a data reader (with a
search criteria)
2 - Filling a listbox with the data retrieved with the data reader
3 - draging items out of the listbox and dropping them into a text box
(simple names)

The error I'm getting is on the mouse down event. When a press the left
mouse button to start the drag event, it gives an error saying that the
"index is outside the bounds of the array"
now this is the code I'm using;

Private Sub lstResultScheduler_MouseDown(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
lstResultScheduler.MouseDown

If e.Button = MouseButtons.Left Then

If lstResultScheduler.Items.Count = 0 Then Exit Sub

'invoke the drag and drop operation

This is the line of code where is failing ****
lstResultScheduler.DoDragDrop(lstResultScheduler.SelectedItem.ToString,
DragDropEffects.Move Or DragDropEffects.Copy) *****

End If

End Sub

Does anybody knows why I'm getting this Problem?

Thanks for your help.

Manny
 
Wrong place

Private Sub ListView1_ItemDrag(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemDragEventArgs) Handles ListView1.ItemDrag

ListView1.DoDragDrop(e.Item, DragDropEffects.Move)

End Sub


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
Back
Top