In the MDI main form I am loading one child form (i.e Login Form)at the center of the MDI form.


I want without closing the child form(Login form)no one can access the MDI main form..
After login only the login page should close and MDI form should enable true..
Before that if anyone click any place other then the login screen then one beep sound should come ..

Can anyone please help me..

usually what i did is to load login form when the application loaded.
MDI form will be loaded only after successful login
when user logout close MDI form and show login form
hope it will help

Here My idea is slightly different..

I want to display all the forms over the MDI form so that in each and every screen user can see the MDI form Menu..so this login screen logic will be help full for me..

Hope u can understand my idea and give further sugessions on this...

Thanks..

huumn do one thing when you laod the MDi parent form show your login form on login form load disable the menu of MDi parent form. and on login button click enable the menu of MDiparent. and Cancel of login button exit from application.
i think this will work for you.

if you got your answer mark thread as a solved.

Thanks..
I have tried...but one error is coming ..

"Object reference not set to an instance of an object."

My code is..
Private Sub Login_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

MdiParent.MainMenuStrip.Enabled = False
End Sub

I am sure i have written the code worngly

Can u please help me in code ...

on form load of mdiparent write this code

Me.Show()//mDIparent form
        f1 = New Form1//login form object
        f1.MdiParent = Me
        f1.Show()

on form load of login page write this code

MDIParent1.MenuStrip.Enabled = False
        Me.Enabled = True

and in sussefull login button put this code.

Me.Hide()
        MDIParent1.Enabled = True
        MDIParent1.MenuStrip.Enabled = True

this code is worked very well at my PC

Yes Done..

Thanks a lot..

when you are done clicking the login button i want another form to be visible inside the MDIparent.. how to do it.. What is the code? can you help me with this? Thank You

dim newfrom as new Form

Newform.mdiparent=mdi
newform.show()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.