Why does this not work

VB2010
'
        If bolFoundItem <> vbTrue Then
            frmBuildSysParam.txtUserID.Text = strUserName
            frmBuildSysParam.Show()
            Me.Close()     ' close frmMainMenu
            Exit Sub
        End If
        '
The system closes out completely (exits the application)   Basically what I am trying to do is if a user has never used the application before to setup certain unique parameter, by loading a system parameter sreen.  This tests the network user ID against a table in MS-Access.  The exit sub should take me out of the procedure not the whole applications.  What am I missing?  
WLoftusAsked:
Who is Participating?
 
WLoftusConnect With a Mentor Author Commented:
Yes I have but you receive an error message that you can't use the command frmMainMenu.close and the solution is to use me.close command.  .  

If you use the command "frmBuildSysParam.ShowDialog()", it works perfect.y.  The frmMainMenu closes as instructed and the frmBuildSysParam form is open with the prompter in the right place.  Why does this work and the simple close command does not?  
0
 
Neil RussellTechnical Development LeadCommented:
me. close is the application and NOT the form. As you are showing the form, the form itself should close itself when finished with.
You CAN use me.close INSIDE the forms code.
0
 
WLoftusAuthor Commented:
The me.close is located in a procedure in the frmmainmenu.vb area, thus it is inside the forms code.  I have replaced the me.close with the me.hide command which did not work either.  I prefer to close out the forms and re open it when needed, (that's the old school in me).  When i open the form with the command "frmBuildSysParam.Show()", I would think the frmBuildSysParam form would have the focus, but it does not the system exits the application completely.  I would have thought that it would have passed control to the frmBuildSysParam form.  The "Exit Sub" command merely ends the procedure.  
0
 
Neil RussellTechnical Development LeadCommented:
Have you tried using frmBuildSysParam.close() ?
0
 
WLoftusAuthor Commented:
Resolved problem myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.