hello frds,
I am trying to draw line by drag and drop between two checkedlistbox where both checkedlistbox is an object of checkedlistbox control. While i try to take start point by mousedown event on checkedlistbox and endpoint by dragdrop event.
but problem is when I drop the mouse, checkedlistbox ctr not activate. So dragdrop event not fire.
plz provide help, if possible code then give me.
thank you .

Please show the code you have for the drag/drop routines

Please show the code you have for the drag/drop routines

My code is here
in this
chktable1 is a checkedlistbox
spl11 is panel control

void listbox1_SelectedIndexChanged(object sender, EventArgs e)
        {
//here I create chktable1 at every select item of listbox on panel 

                chktable1.MouseDown += new MouseEventHandler(chktable1_MouseDown);
                chktable1.MouseMove += new MouseEventHandler(chktable1_MouseMove);
                spl11.DragEnter += new DragEventHandler(spl11_DragEnter);
                chktable1.DragDrop += new DragEventHandler(chktable1_DragDrop);

        }


  private System.Windows.Forms.RichTextBox DebugWindow;

        bool mDraging = false;
        void chktable1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
                mDraging = true;
        }
        private string mRecallFileName;
        void chktable1_MouseMove(object sender, MouseEventArgs e)
        {
            DebugWindow = new System.Windows.Forms.RichTextBox();
            if (!mDraging)
                return;

            if (e.Button != MouseButtons.Left)
                return;

            //Initial condition

            if (chktable1.SelectedItem==null)
                return;
            mRecallFileName =(string)chktable1.SelectedItem.ToString();

            //Make sure that there is a filename associated with this node
            if (mRecallFileName == string.Empty)
            {
                mDraging = false;
                return;
            }

            DebugWindow.AppendText("Dragging File: " + mRecallFileName + "\n");
            chktable1.DoDragDrop(mRecallFileName,DragDropEffects.Copy | DropEffects.Move);


        }
        void spl11_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Text))
                e.Effect = DragDropEffects.Copy;
            else
                e.Effect = DragDropEffects.None;
        }

 void chktable1_DragDrop(object sender, DragEventArgs e)
        {
            if (chktable1.CanFocus == true)
            {
                mDraging = false;
                chktable1.DoDragDrop(mRecallFileName, DragDropEffects.None);
                MessageBox.Show("ii"+mRecallFileName);
            }
        }

I dont see that you would need to add the events for each time you select an item, however, what icon do you get as you drag over the destination?

in that code i just try to return name of selected item of dragged object.
but basically i want to draw a line b/w these checkedlistbox's item.

As I asked, what Icon do you get as you drag over the destination? If you dont get one its not firing because it doesnt know its supposed to

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.