Setting DialogResult in OnClosing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In all the documentation on DialogResults it says that you can override the
DialogResult in the OnClosing event. I am working in VB and I just cannot do
this. I call ShowDialog with an OK in the top right. The form always returns
an OK whatever I do in the OnClose.
Is this an undocumented difference between CF and the desktop.
 
Can you show the code? This works for me fine
VS2005, CF v2, VB PPC2003 project. In the OnClosing event of the second form
that I show with ShowDialog I have this line of code
Me.DialogResult = Windows.Forms.DialogResult.XXX 'XX = your choice

The calling code in form1 correctly gets the result I expect.

Cheers
Daniel
 
In a CF application, if a form is shown with ShowDialog command, and
then dismissed by tapping on the OK button in the title bar, will
always return the DialogResult property value to be DialogResult.OK,
irrespective of the DialogResult value set in the Closing
event-handler.

This indeed is an behavioral difference between the CF and the full
Framework.
 
I noticed v2, but was under the assumption that v2 works only with
WM5 devices. I just discovered that it also supports PPC2003 devices.
So, thanks Daniel for pointing out v2 thing to me. :-)
 
Thanks guys

Dinesh Bajaj said:
I noticed v2, but was under the assumption that v2 works only with
WM5 devices. I just discovered that it also supports PPC2003 devices.
So, thanks Daniel for pointing out v2 thing to me. :-)
 
Back
Top