Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 1st, 2008, 09:24 PM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default help please with loading and unloading forms

I am currently working on a phone book project, the phone book has two forms , Frmlogin and frmPbook. I have finally been able to get the the frmlogin to work porperly however when clicking on proceed it opens the second form but for some reason I am not able to get frmlogin to close after frmPbook loads. Please help , Thank you.

the code for frmlogin is listed below.

Public Class FrmLogin

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
        ' Make sure the user entered something.
        If TxtUname.Text.Length = 0 Then
            MsgBox("You must enter a user name", _
                MsgBoxStyle.Exclamation)
            TxtUname.Focus()
        ElseIf TxtPword.Text.Length = 0 Then
            MsgBox("You must enter a password", _
                MsgBoxStyle.Exclamation)
            TxtPword.Focus()
        End If

        If TxtUname.Text <> "Tom" And TxtPword.Text <> "mash4077" Then
            MsgBox("Your UserName and Password are Incorrct", _
                MsgBoxStyle.Exclamation)
            TxtUname.Focus()
            TxtPword.Focus()
        End If

        If TxtPword.Text = "mash4077" And TxtUname.Text = "Tom" Then
            Btnfailpass.Text = "Click Here to Proceed" 'Continue
        End If

        If Btnfailpass.Text = "Click Here to Proceed" Then
            Btnfailpass.Visible = True
        End If
    End Sub

    Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click
        End 'clicked cancel button
    End Sub

    Private Sub FrmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TxtPword.PasswordChar = "*"

    End Sub

    Private Sub Btnfailpass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnfailpass.Click
        FrmPbook.ShowDialog()

    End Sub
End Class
--------------------------------------------------------------------------------



 
Old January 2nd, 2008, 02:03 PM
Registered User
 
Join Date: Dec 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried Frmlogin.hide?


also I think showDialog will keep the focus until you close it.
So manualy closing it will not be possible.
try show instead?
 
Old January 4th, 2008, 10:01 AM
Authorized User
 
Join Date: Dec 2007
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to pannasn
Default

Hi,

Try the following :

FrmLogin login=new FrmLogin();
login.close();
FrmPbook.Show();

Thanks
Panna





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web forms loading - Chapter 17 InfinityLtd BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 May 22nd, 2008 09:21 AM
Loading & Unloading roy.supratim05 Visual Studio 2005 1 May 18th, 2007 06:16 AM
Help for unloading the assembly in c# FlyCode .NET Framework 2.0 1 March 25th, 2006 08:27 AM
Loading forms dynamically bmains C# 2005 1 November 30th, 2005 03:53 PM
Problem with loading MDI Child Forms. david29118 VB.NET 2002/2003 Basics 0 May 22nd, 2005 07:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.