473,414 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Passing control to another form

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
2 1471
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: rettigcd | last post by:
Hello, I need to create a custome form that operates similar to the MsgBox() and InputBox() functions. I can't figure out how to pass data to a MODAL dialog box (form). I've tried 3...
2
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state,...
3
by: Joe Bloggs | last post by:
Does anyone know if its possible to pass parameters or the values of Request.QueryString from a web page to a custom control class? I'm using a C# Web Application. For Example I have Web Page1...
6
by: Max | last post by:
Last time I tried to explain this on another forum it didn't go too well, so I'll try my best and if you know what I'm talking about then please tell me how to do this. I have a class, inside I...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
2
by: dixiecanterbury | last post by:
I have a tree view on a form and I need to pass that treeview to another form keeping the state of the treeview (expanded nodes, etc). After the treeview has been manipulated (added nodes,...
4
imrosie
by: imrosie | last post by:
Hello All, (newbie)...I'm working on an Ordering app using the typical tables (customers, orders). I have a Search form to find existing customers prior to entering a new order. On the search form...
0
by: AAaron123 | last post by:
On a Form I have a RichTextBox. I do the call for EM_SETEVENTMASK with ENM_REQUESTRESIZE The user control's WndProc writes to the consol to keep track of any EN_REQUESTRESIZE messages. As...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
1
by: brixdotnet | last post by:
Hi there! I made own user control for displaying and editing content. In Page_Load of this control is checked if user is authorized for editing if so, button for editing is shown, otherwise...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.