error occuring while opening the form second time

HI I have faced a typical exception while running my application.

my application contains 3 forms 1.login,2.Main form 3.dataentry form

in my application first i will going through some id and then in the main form menu item i call the dataentry form.upto that is fine.

there is a logout menuitem in my main form.if i logout then the login form will again appear so i will login using some other id now if i call the dataentry form the exception occuring from where i was calling the form. the exception was

An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll

Additional information: Invalid parameter used.

the form was calling using show dialog and i'm also using the dispose method after closing the form.

can any one tell the solution to this.here i'm providing the code of the form.Thanks in advance

-regards

GRK

calling the dataentry from from main form

Try

Dim trFrmSExcuse As New FrmSRegn

trFrmSExcuse.ShowDialog()

trFrmSExcuse.Dispose()

Catch ex As Exception

MessageBox.Show(ex.Message, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try




Answer this question

error occuring while opening the form second time

  • ZimY

    If frme.showdialog(me) also gives an error then the next step is to see what you have in the initialize component or the load method of the form "frme"

  • Alexandr Vishnyakov

    What line of code is throwing the error

    Run your app in debug mode and it should stop and Highlight the line that is causeing the error....if it does not then you will have to step into the code line by line util the error occurs



  • MechEng85

    HI

    now the problem was solved. the first form is not disposing while closing so when again i open it then the error come so i'm externally calling the dispose method.now it is cleared. thank you verymuch for your replies



  • Wee Bubba

    It is highlighting the frme.showdialog() line



  • error occuring while opening the form second time