I need help with drag and drop listbox to a textbox. Heres my situation. Below are my code:
The problem now is that the lstScholar.SelectedItem() isnt select the curent selected item. This code only works for the first try. Any addtional attemp to select items in the listbox and drop them to the textbox2 will not work. Theres no error generated by the selection never refresh to reflect the selected item in the listbox. Please help.
Many help in advance!
Charlie
Private Sub TextBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub TextBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop
Dim strTextBox2 As String
popAmount()
strHolder = e.Data.GetData(lstScholar.SelectedItem.GetType.ToString())
TextBox2.Text = strHolder & vbCrLf & "SSN#: " & strSSN & "Amount Award: $" & strAmount
End Sub
Private Sub popAmount()
Dim jmpFrmAmount As New frmAmount()
jmpFrmAmount.ShowDialog()
strAmount = jmpFrmAmount.txtAmount.Text()
strSSN = jmpFrmAmount.txtSSN.Text()
End Sub
Private Sub lstScholar_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstScholar.MouseDown
lstScholar.Refresh()
lstScholar.DoDragDrop(lstScholar.SelectedItem, DragDropEffects.Copy Or DragDropEffects.Move)
End Sub
The problem now is that the lstScholar.SelectedItem() isnt select the curent selected item. This code only works for the first try. Any addtional attemp to select items in the listbox and drop them to the textbox2 will not work. Theres no error generated by the selection never refresh to reflect the selected item in the listbox. Please help.
Many help in advance!
Charlie