PC Review


Reply
Thread Tools Rate Thread

Disposing of a log in window

 
 
Damian
Guest
Posts: n/a
 
      1st Mar 2004
Hi !

I am trying to dispose of the startup form in my application a login
form (frmLogin) after it calls the main form (frmMain). I cant seem to
get it to work. Here is my code.

frmLogin Code
==============

Sub btnSave_Click

Dim mainF As New frmMain

mainF.Show()
Me.Dispose()

End Sub

The main form flashes up and then the whole app closes down as it goes
to the next line (Me.Dispose()). What needs to happen is the main form
loads then the login form is not visible and unloaded from memory.

Any help is appreciated, thanks !
 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      1st Mar 2004
Hi,

Use mainF.ShowDialog instead of mainF.Show. Showdialog will
wait until the form is closed before executing the next line of code.

Ken
-----------------
"Damian" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi !
>
> I am trying to dispose of the startup form in my application a login
> form (frmLogin) after it calls the main form (frmMain). I cant seem to
> get it to work. Here is my code.
>
> frmLogin Code
> ==============
>
> Sub btnSave_Click
>
> Dim mainF As New frmMain
>
> mainF.Show()
> Me.Dispose()
>
> End Sub
>
> The main form flashes up and then the whole app closes down as it goes
> to the next line (Me.Dispose()). What needs to happen is the main form
> loads then the login form is not visible and unloaded from memory.
>
> Any help is appreciated, thanks !



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      1st Mar 2004
Hi Damian,

I had this problem yesterday also when I was making a sample from a splash
form.
Today I thought let find somebody else find this solution for you, but
thinking it over it is simple.

I hope this helps?

Cor

\\\
private frm as new form2
Private WithEvents timer1 As New Windows.Forms.Timer
Private Sub Form1_Load(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
timer1.Enabled = True
timer1.Interval = 12500
frm.Show()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles timer1.Tick
if frm.readyswitch = true then 'readyswitch as public variable
frm.Close()
frm.Dispose()
timer1.Enabled = False
end if
End Sub
///


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disposing Rob Microsoft ASP .NET 4 11th Jan 2007 01:47 PM
Disposing - when? TyBreaker Microsoft VB .NET 1 22nd Aug 2006 12:01 PM
Agressive disposing Elisa Microsoft Dot NET Compact Framework 2 10th Feb 2004 10:41 PM
disposing of oe santy Windows XP Internet Explorer 4 3rd Jan 2004 01:25 AM
Disposing controls Carel Lotz Microsoft Dot NET Framework Forms 5 10th Dec 2003 01:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:56 PM.