Help with Index is out of the bounds 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
 
I would post this on one of the VB.NET newsgroups...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top