473,405 Members | 2,379 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,405 software developers and data experts.

Hide Login screen when entering application

I am new to .Net and Visual Studio, I have a login form and my main
application form. When I login I want to call the application form, and
dispose of the login. I have tried doing something like:

This.Hide
myAppfrm.Show();

but then when I close down the myAppfrm, the system hangs as the login
screen is still floating about in memory. How is this delt with normally in
the .Net fraternity?

Thanks
Jul 21 '05 #1
3 2368
I have done this now, which seems to do the job but not sure how right it is:

if(loggedIn == true)
{
MainScreen myMainScreen = new MainScreen();
this.Hide();
myMainScreen.ShowDialog();
this.dispose();
}

so now it runs the application, then disposes the hidden login screen when
they close the application. Is this correct?
"Steve" wrote:
I am new to .Net and Visual Studio, I have a login form and my main
application form. When I login I want to call the application form, and
dispose of the login. I have tried doing something like:

This.Hide
myAppfrm.Show();

but then when I close down the myAppfrm, the system hangs as the login
screen is still floating about in memory. How is this delt with normally in
the .Net fraternity?

Thanks

Jul 21 '05 #2
You will need to create a Sub Main() Method within a module and set
the Main() method as the startup object, this can be done in the
project properties dialog

the module containing the Sub Main() method will then need to contain
something similar to the following

Module modMain

Public Sub Main()

Dim objLoginForm as New LoginForm

'Use showdialog() instead of show() to stop the
'application from displaying the main form until the
login form has been closed
objLoginForm.ShowDialog

'Create the main form
Dim myAppfrm as new YourMainForm

'Use Application.Run instead of myAppfrm.show as this
will then treat the myAppfrm as the main message loop and not exit the
application until it has closed
Application.Run(myAppfrm)

End Sub

End Module

I hope this helps.

Regards

James Thresher
On Wed, 15 Jun 2005 03:14:03 -0700, "Steve"
<St***@discussions.microsoft.com> wrote:
I am new to .Net and Visual Studio, I have a login form and my main
application form. When I login I want to call the application form, and
dispose of the login. I have tried doing something like:

This.Hide
myAppfrm.Show();

but then when I close down the myAppfrm, the system hangs as the login
screen is still floating about in memory. How is this delt with normally in
the .Net fraternity?

Thanks


Jul 21 '05 #3
Hi,

Just noticed that you are using c#, my previous post was a solution
for VB.NET, my apologies. the following should work for c#
[STAThread]
static void Main()
{

LoginForm objLoginForm = new LoginForm();

//Use showdialog() instead of show() to stop the
//application from displaying the main form until the
login form has been closed
objLoginForm.ShowDialog();

//Create the main form
YourMainForm myAppfrm = new YourMainForm();

//Use Application.Run instead of myAppfrm.show as this
will then treat the myAppfrm as the main message loop and not exit the
application until it has closed
Application.Run(myAppfrm());

}

Regards

James Thresher

On Wed, 15 Jun 2005 03:14:03 -0700, "Steve"
<St***@discussions.microsoft.com> wrote:
I am new to .Net and Visual Studio, I have a login form and my main
application form. When I login I want to call the application form, and
dispose of the login. I have tried doing something like:

This.Hide
myAppfrm.Show();

but then when I close down the myAppfrm, the system hangs as the login
screen is still floating about in memory. How is this delt with normally in
the .Net fraternity?

Thanks


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mark | last post by:
Hi - I have a document management system in ASP/VBScript, which copies files to a http://www./files directory. While uploading files to that directory, it also updates a database with full path...
0
by: Bassem | last post by:
Hi All, I had problem when using Crystal Report in C# windows application. I create report depend upon dataset using table from SQL 2000 and add it in a C# windows application. NP: The...
8
by: Just D. | last post by:
Did anybody see the script to hide extra bars in the Internet Explorer? I'd like to start my WebApp with all these bars hidden. How? Thanks, Just D.
4
by: BrianDH | last post by:
Hi I have an application with 3 windows forms. One of which I load at startup but hide, then show/hide based on users click. How can I test to see if the windows is hidden, or is at the moment...
3
by: Steve | last post by:
I am new to .Net and Visual Studio, I have a login form and my main application form. When I login I want to call the application form, and dispose of the login. I have tried doing something...
9
by: dana lees | last post by:
Hello, I am developing a C# asp.net application. I am using the authentication and authorization mechanism, which its timeout is set to 60 minutes. My application consists of 2 frames - a...
1
by: beachboy | last post by:
how can pass the login (security info) to secondary application? ASP.NET 1.1 user login to application 1(app1.myapp.com) with their username and password, then they have a link to application 2...
10
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi In my app I have a SplashScreen, a login form and a main form. On launching the app, I'd like to show the SplashScreen while reading config files and attempting a database connection. I show...
4
by: Gaz | last post by:
I am having a bit of a problem getting my application to work properly. RIght here is my problem... WHen my C# windows app loads up the start form, i create a new thread and show the splash...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.