By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Passing control to another form

P: n/a
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!!
--
Kevin
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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/...ity/newsgroups
"ksedran" <ks*****@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
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!!
--
Kevin

Nov 21 '05 #2

P: n/a
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.

"William Ryan eMVP" wrote:
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/...ity/newsgroups
"ksedran" <ks*****@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
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!!
--
Kevin


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.