Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Problems hiding my loging form.

ganesh.rganesh.r Posts: 2Member
Hi All
I am having some problems hiding my loging form.

From the SuB Main, the Login forms shown
After the user sucessfully entered user name and password, the login form should
close and the Main Application window show open

This is what i have done to close the login form

dim frmlogin as new Loginform
dim frmMain as new MainWindow

frmlogin.hide
frmMain.showDiolog

Any ideas ???.

Comments

  • biohazard 2.0biohazard 2.0 Posts: 30Member
    : Hi All
    : I am having some problems hiding my loging form.
    :
    : From the SuB Main, the Login forms shown
    : After the user sucessfully entered user name and password, the login form should
    : close and the Main Application window show open
    :
    : This is what i have done to close the login form
    :
    : dim frmlogin as new Loginform
    : dim frmMain as new MainWindow
    :
    : frmlogin.hide
    : frmMain.showDiolog
    :
    : Any ideas ???.
    :

    Your problem is everywhere...

    Lets say your Login form is named LoginFRM1 this is what you do:
    LoginFRM1.Hide
    'Why is your Main Form a dialog?
    frmMain.Show
    ' Another thing, when you declared your LoginForm,
    'why did you do it
    'as a new? That does not refer to your original form
  • biohazard 2.0biohazard 2.0 Posts: 30Member
    : : Hi All
    : : I am having some problems hiding my loging form.
    : :
    : : From the SuB Main, the Login forms shown
    : : After the user sucessfully entered user name and password, the login form should
    : : close and the Main Application window show open
    : :
    : : This is what i have done to close the login form
    : :
    : : dim frmlogin as new Loginform
    : : dim frmMain as new MainWindow
    : :
    : : frmlogin.hide
    : : frmMain.showDiolog
    : :
    : : Any ideas ???.
    : :
    :
    : Your problem is everywhere...
    :
    : Lets say your Login form is named LoginFRM1 this is what you do:
    : LoginFRM1.Hide
    : 'Why is your Main Form a dialog?
    : frmMain.Show
    : ' Another thing, when you declared your LoginForm,
    : 'why did you do it
    : 'as a new? That does not refer to your original form
    :
    Sorry, ignore that, I was thinking this was VB6, but tell me, what is your error saying?

  • ganesh.rganesh.r Posts: 2Member
    : : : Hi All
    : : : I am having some problems hiding my loging form.
    : : :
    : : : From the SuB Main, the Login forms shown
    : : : After the user sucessfully entered user name and password, the login form should
    : : : close and the Main Application window show open
    : : :
    : : : This is what i have done to close the login form
    : : :
    : : : dim frmlogin as new Loginform
    : : : dim frmMain as new MainWindow
    : : :
    : : : frmlogin.hide
    : : : frmMain.showDiolog
    : : :
    : : : Any ideas ???.
    : : :
    : :
    : : Your problem is everywhere...
    : :
    : : Lets say your Login form is named LoginFRM1 this is what you do:
    : : LoginFRM1.Hide
    : : 'Why is your Main Form a dialog?
    : : frmMain.Show
    : : ' Another thing, when you declared your LoginForm,
    : : 'why did you do it
    : : 'as a new? That does not refer to your original form
    : :
    : Sorry, ignore that, I was thinking this was VB6, but tell me, what is your error saying?
    :
    :
    NO, There is on error message, login form is not closing when the main window open

  • aamirwaziraamirwazir Posts: 108Member
    may be the better approach is to open the login form from the main window
    i dnt know wat u r trying to do but the user has to get logined thru Sign in menu item or any button
    so if u do this ur parent form will be main form and login child can be disposed any time...
  • dokken2dokken2 Posts: 532Member
    : may be the better approach is to open the login form from the main window
    : i dnt know wat u r trying to do but the user has to get logined thru Sign in menu item or any button
    : so if u do this ur parent form will be main form and login child can be disposed any time...
    :


    You have to remember that vb.net is object-oriented and be aware of scope.

    In your login form-

    [code]
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim MyMain As New Form_Main(Me)
    MyMain.Show()
    Me.Hide 'HIDE LOGIN FORM
    End Sub
    [/code]

    In the Main form-

    [code]
    Public Class Form_Main
    Inherits System.Windows.Forms.Form

    Dim MyLogin As Form 'REFERENCE LOGIN FORM
    #Region " Windows Form Designer generated code "

    Public Sub New(ByVal frm As Object) 'PASS PARENT/LOGIN FORM
    MyBase.New()
    MyLogin = frm 'POINT TO LOGIN FORM

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    ...

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    MyLogin.Show 'SHOW LOGIN FORM
    End Sub
    [/code]
  • aamirwaziraamirwazir Posts: 108Member
    u r trying the above snippet of code of the lower one..well i recomend u too adopt the latter part...
    tht on load event u call the login form
    and close the login form if it is successfull or the user clicks cancel button
    SIMPLE :)
Sign In or Register to comment.