开发者

Cannot call Invoke or BeginInvoke on a control until the window handle has been created

Hi I googled this but I did not realy find too much Here is my situation I Have ListBox and I enabled drag and drop option I add an background worker to do for me somework Well When I drag and drop first time evry thing go ok When I drag and drop se开发者_运维百科conod time I have that problem

Here is my code

 if (imageListBox.InvokeRequired)
            {
                imageListBox.Invoke(new MethodInvoker(delegate {
                    try
                    {
                        imageListBox.Items.Remove(fileInf.Name); 
                    }
                    catch (Exception)
                    {
                        Form2 frm = new Form2();
                        IntPtr a = frm.Handle;
                        imageListBox.Items.Remove(fileInf.Name); 
                    }

                }));
            }

Form this block

catch (Exception)
                        {
                            Form2 frm = new Form2();
                            IntPtr a = frm.Handle;
                            imageListBox.Items.Remove(fileInf.Name); 
                        }

I've add it when I got the problem but it sem that it does not solve the problem

Any help please ?thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜