H
Holysmoke
Hi All,
I am trying to do drag n drop effect from the values of the checkedboxlist
to a textbox and the code works fine as expected. But the checkedboxlist
loses it characteristics ie single click on the check box of the item.
I have written a mousedown event on the checkedboxlist for drag n drop
effect and it prevents the single click event of the checkbox item. How can I
overcome this problem?
TIA,
Holy
Here is my code,
Please create a new form named form1 and add a textbox and checkedboxlist
into the form and paste this code
Private Sub CheckedListBox1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles CheckedListBox1.MouseDown
CheckedListBox1.DoDragDrop(CheckedListBox1.SelectedItem,
DragDropEffects.Copy)
End Sub
Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop
If e.Data.GetDataPresent(GetType(System.String)) Then
TextBox1.Text = DirectCast(e.Data.GetData(GetType(String)),
String)
End If
TextBox1.BorderStyle = BorderStyle.Fixed3D
End Sub
Private Sub TextBox1_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter
If e.Data.GetDataPresent(GetType(System.String)) Then
e.Effect = DragDropEffects.Copy
TextBox1.BorderStyle = BorderStyle.FixedSingle
End If
End Sub
I am trying to do drag n drop effect from the values of the checkedboxlist
to a textbox and the code works fine as expected. But the checkedboxlist
loses it characteristics ie single click on the check box of the item.
I have written a mousedown event on the checkedboxlist for drag n drop
effect and it prevents the single click event of the checkbox item. How can I
overcome this problem?
TIA,
Holy
Here is my code,
Please create a new form named form1 and add a textbox and checkedboxlist
into the form and paste this code
Private Sub CheckedListBox1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles CheckedListBox1.MouseDown
CheckedListBox1.DoDragDrop(CheckedListBox1.SelectedItem,
DragDropEffects.Copy)
End Sub
Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop
If e.Data.GetDataPresent(GetType(System.String)) Then
TextBox1.Text = DirectCast(e.Data.GetData(GetType(String)),
String)
End If
TextBox1.BorderStyle = BorderStyle.Fixed3D
End Sub
Private Sub TextBox1_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter
If e.Data.GetDataPresent(GetType(System.String)) Then
e.Effect = DragDropEffects.Copy
TextBox1.BorderStyle = BorderStyle.FixedSingle
End If
End Sub