A
active
Code below.
Starting to use DragDrop and I get the message that the index is out of
range when I mouse down and move a little. The box has maybe 10 items and
I'm selecting one in the middle.
Second question. In the examples for ListBox they use:
alstFrom.SelectedItem.Text but when I add a dot after SelectedItem I get
only the option GetType. Can this be explained??
Finally. The conversion from VB6 placed ByRef with the first argument. Any
reason. Seems like ByVal would also work. In fact I think it would work even
if I wanted to make changes in the listbox. Is ByRef the preferred way.
Thanks for any insight passed along,
Cal
Private Sub MouseMoveHelper(ByRef alstFrom As System.Windows.Forms.ListBox,
ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = 0 Or alstFrom.Items.Count < 1 Or mbolDragProhibited Then Exit
Sub
Dim tbase As ListBox = DirectCast(sender, ListBox)
Dim data As New DataObject
data.SetData(DataFormats.Text, CStr(alstFrom.SelectedItem))
Dim effect As DragDropEffects = DragDropEffects.Move
effect = tbase.DoDragDrop(data, effect)
End Sub
Starting to use DragDrop and I get the message that the index is out of
range when I mouse down and move a little. The box has maybe 10 items and
I'm selecting one in the middle.
Second question. In the examples for ListBox they use:
alstFrom.SelectedItem.Text but when I add a dot after SelectedItem I get
only the option GetType. Can this be explained??
Finally. The conversion from VB6 placed ByRef with the first argument. Any
reason. Seems like ByVal would also work. In fact I think it would work even
if I wanted to make changes in the listbox. Is ByRef the preferred way.
Thanks for any insight passed along,
Cal
Private Sub MouseMoveHelper(ByRef alstFrom As System.Windows.Forms.ListBox,
ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = 0 Or alstFrom.Items.Count < 1 Or mbolDragProhibited Then Exit
Sub
Dim tbase As ListBox = DirectCast(sender, ListBox)
Dim data As New DataObject
data.SetData(DataFormats.Text, CStr(alstFrom.SelectedItem))
Dim effect As DragDropEffects = DragDropEffects.Move
effect = tbase.DoDragDrop(data, effect)
End Sub