Passing control to another form

G

Guest

Hello All,

Having a lot of trouble with what seems to be a simple task.
I have a windows app that starts with a login form. Once the user logs in
the main application screen starts.

I can't find a way to close the login form without closing the rest of the
app. So as a band-aid I am currently just hiding the login form.

Me.Hide()
Dim CMIMain As New CMIMain()
CMIMain.Show()

This is not what I want as the login form is still hidden even after the
CMIMain is closed, therefore the program never really closes.

I have tried making the CMIMain as the startup page, then get the erorr:
'Sub Main' was not found in 'CMI.CMIMain'.

If I add a sub Main() to CMIMain I get the error:

No accessible 'Main' method with an appropriate signature was found in
'CMI.CMIMain'.

Any Suggestions to get me on the right track?

Thanks!!
 
W

William Ryan eMVP

You seem to have two problems. First, check this out
http://www.knowdotnet.com/articles/application.run.html . As far as
accessing controls on other forms, you'll need to create public properties
for those values and set them before you call the new form, or have the form
with the properties set those values

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
G

Guest

Thanks for the help William. That worked!

I created a module and opened the login with .ShowDialog.
If the Login is a success, then I disposed of that, and then used
application.run to run the main section of the program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top