hi i have an mdi form n 3 other form
namely patient,about, tips.
i do not want the user to access any other form when he/she is using the about ,patient or tips form.
the user must close to be able 2 access any other form.

i have search a lot in the form properties bt i can't see any prpties 4 this

thanks

Dani AI

Generated

Short answer: make those windows modal or simulate modality for true MDI children. is right that modality is the usual fix, but there are a couple of important caveats and alternatives to consider.

Important rule: a form that is an MDI child cannot be shown as a true modal dialog. If you want the window to block all other app windows until it closes, show it as a dialog owned by the MDI parent (do not set its MdiParent). That gives the cleanest behavior and avoids focus/menu problems. Center the dialog over the MDI parent for better UX.

If the window must remain inside the MDI client area (an MDI child), you cannot make it truly modal; instead simulate modal behavior by disabling other children and the main menus/toolbars while the child is open. Example VB.NET pattern to do this safely:

' in the MDI parent
Dim dlg As New ChildForm()

Dim disabled As New List(Of Form)()
For Each c As Form In Me.MdiChildren
    If c IsNot dlg AndAlso c.Enabled Then
        c.Enabled = False
        disabled.Add(c)
    End If
Next
MenuStrip1.Enabled = False

dlg.MdiParent = Me
AddHandler dlg.FormClosed, Sub(s, e)
                               For Each c As Form In disabled
                                   If Not c.IsDisposed Then c.Enabled = True
                               Next
                               MenuStrip1.Enabled = True
                           End Sub

dlg.Show()

Troubleshooting tips: use Try/Finally or FormClosed handlers so UI always gets re-enabled if an error occurs. Avoid disabling the entire parent window (that can block message processing); disable only other children and menus. For most cases, prefer the owned dialog approach for simplicity and reliability.

Hi
I think Show the form modally will help u.

Refer

Form.ShowDialog()  method
or 
  Form.ShowDialog(Owner) method

Try this

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.