ta*******@superonline-dot-com.no-spam.invalid (CoolWriter) wrote in message news:<40**********@Usenet.com>...
Hi,
How can I drag and drop the items of a ListBox?
For example, how can I drag the first item to the third items position
in a ListBox?
Thanks.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Add these two events to your listbox and declare object thing as a
public variable
public void listBox1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
int temp;
temp = listBox1.SelectedIndex;
listBox1.Items.Remove(thing);
listBox1.Items.Insert(temp, thing);
}
public void listBox1_MouseDown(object
sender,System.Windows.Forms.MouseEventArgs e )
{
int temp;
temp = listBox1.SelectedIndex;
thing = listBox1.Items[temp];
}