473,239 Members | 1,541 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,239 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 2355
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
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.