I have 2 Forms(Form1 and Form2)
(Form2) doesn't contain a close button (x), it will be closed based on the keydown_event (press Esc) to hide (Me.hide) and will be opened (Frm2.location = mypoint: Frm2.showdialog()) based on the click event in Form 1.
The problem is that Form2 is inherited from SfForm (I only initialize Form2 only once: Frm2 = new form2, then will not use New() because I only need show and hide and I need to load some data so .visible cann't use). Everything well in the first showdialog. but when Form 1 triggered the 2nd event. I got an error in both of these lines (in Class Form1)
Frm2.location = mydefinepoint
Frm2.showdialog ()
When I addwatch it seems that it is still running in another stream and cannot be viewed.
Parameter is not valid.
************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Region.GetHrgn(Graphics g)
at System.Windows.Forms.Control.GetHRgn(Region region)
at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Form.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmCreate(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Additionally: Frm2.showdialog () reported the error:
'Form showDialog tried to set an ineligible form as its owner. Forms cannot own themselves or their owners.
when I changed the inherit SfForm to Form, it worked.
What should i do to avoid this?