Hi people!
I want to ask something about the Event procedures MouseDown and Double click... here it goes:
I have 2 list boxes and i want to be able to drag and drop the item i selected from one listbox to the other. at the same time i want to use the double click event to add items to one of my listboxes.. it seems that only the mousedown event fires and the double click doesnt seem to be executed...
here is my code:
private void lstFieldsAvailable_DoubleClick(object sender, System.EventArgs e)
{
this.lstFieldsSelected.Items.Add( this.lstFieldsAvailable.Items[this.lstFieldsAvailable.SelectedIndex].ToString());
}
private void lstFieldsAvailable_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
try
{
this.lstFieldsAvailable.DoDragDrop(this.lstFieldsAvailable.Text.ToString(),DragDropEffects.Copy);
}
catch
{
return;
}
}
private void lstFieldsSelected_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void lstFieldsSelected_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
this.lstFieldsSelected.Items.Add(this.lstFieldsAvailable.Items[this.lstFieldsAvailable.SelectedIndex].ToString());
}
any help is heartfully appreciated.. tnx!
KDjLogan
I want to ask something about the Event procedures MouseDown and Double click... here it goes:
I have 2 list boxes and i want to be able to drag and drop the item i selected from one listbox to the other. at the same time i want to use the double click event to add items to one of my listboxes.. it seems that only the mousedown event fires and the double click doesnt seem to be executed...
here is my code:
private void lstFieldsAvailable_DoubleClick(object sender, System.EventArgs e)
{
this.lstFieldsSelected.Items.Add( this.lstFieldsAvailable.Items[this.lstFieldsAvailable.SelectedIndex].ToString());
}
private void lstFieldsAvailable_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
try
{
this.lstFieldsAvailable.DoDragDrop(this.lstFieldsAvailable.Text.ToString(),DragDropEffects.Copy);
}
catch
{
return;
}
}
private void lstFieldsSelected_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void lstFieldsSelected_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
this.lstFieldsSelected.Items.Add(this.lstFieldsAvailable.Items[this.lstFieldsAvailable.SelectedIndex].ToString());
}
any help is heartfully appreciated.. tnx!
KDjLogan