Value does not fall within the expected range

  • Thread starter Thread starter Scott Toney
  • Start date Start date
S

Scott Toney

I am calling a form with:

fNewEntry = New frmNewEntry
fNewEntry.ShowDialog()

On the frmNewEntry form, I have a new menu structure that calls other forms
in the same way but everytime I call a new form, I am running a procedure to
close the prior form. When I "exit" the NewEntry form, I am doing a
fNewEntry.Close() and fNewEntry = nothing in the GotFocus sub, and am
getting an argumentexception of Value does not fall within the expected
range.

at
Microsoft.AGL.Common.MISC.HandleAR()
at
System.Windows.Forms.Form_CloseModal()
at
ND.frmOrder.frmOrder_GotFocus
................

Any ideas?
Thanks
Scott
 
ShowDialog() is for Modal forms. These do not sound like good candidates
for modal forms. Use .Show() instead, then you will never need to set the
form reference to nothing when it closes. Is fNewEntry a global var? I'm
not sure what scope you are getting this form reference from in the GotFocus
sub.

-Dave
 
Back
Top