Event GiveFeedback cann’t be found

yemulss

New member
Joined
Mar 1, 2007
Messages
2
Programming Experience
Beginner
Hello,

this is a bit old thread, but I am getting error for the same, so please help me sort this,

I am getting error like

Event GiveFeedback cann’t be found.
Name DragDropEffects cann’t be declared.
Event MouseDown event cann’t be found
Name DataFormats cann’t be declared.
=======================

I used following code of file

VB.NET:
Dim textcursor As Cursor
 
Private Sub ListBox1_GiveFeedback(ByVal sender As Object, ByVal e As System.Windows.Forms.GiveFeedbackEventArgs) _
Handles ListBox1.GiveFeedback
  If e.Effect = DragDropEffects.Move Then
    e.UseDefaultCursors = False
    System.Windows.Forms.Cursor.Current = textcursor
  End If
End Sub
 
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles ListBox1.MouseDown
  Dim ix As Integer = ListBox1.IndexFromPoint(e.Location)
  If ix <> -1 Then
    drawcursor(ListBox1.Items(ix).ToString, ListBox1.Font)
    ListBox1.DoDragDrop(ix.ToString, DragDropEffects.Move)
  End If
End Sub
 
Private Sub ListBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
Handles ListBox1.DragOver
  If e.Data.GetDataPresent(DataFormats.Text) Then
    e.Effect = DragDropEffects.Move
    ListBox1.SelectedIndex = ListBox1.IndexFromPoint(ListBox1.PointToClient(New Point(e.X, e.Y)))
  End If
End Sub
 
Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
Handles ListBox1.DragDrop
  If e.Data.GetDataPresent(DataFormats.Text) Then
    Dim dix As Integer = CInt(e.Data.GetData(DataFormats.Text))
    Dim ix As Integer = ListBox1.IndexFromPoint(ListBox1.PointToClient(New Point(e.X, e.Y)))
    If ix <> -1 Then
      Dim obj As Object = ListBox1.Items(dix)
      ListBox1.Items.RemoveAt(dix)
      ListBox1.Items.Insert(ix, obj)
      ListBox1.SelectedIndex = ix
    End If
  End If
End Sub
 
Where did you put the code? It belongs in a Form class.
What project type are you using? The old thread you posted to was for Windows Forms, so I split your post to this forum also.
 
Back
Top