Search code examples
vb.netwinformsmdimdichildmdiparent

How do I remove the Maximized MDI Child's name from the MDI Parent's Title Bar?


I am making an MDI application in Visual Basic with Windows Forms. When an MDI Child is maximized in Windows Forms, the child's title name is displayed in the title bar of the MDI Parent. I don't like the way this is formatted and I would like to disable the text from showing in my MDI Parent's title. Here is what it looks like:

A windows form with an MDI Child maximized showing the child's title name in the parent's title bar.

I have tried changing the form's Text property whenever it was changed and if it had a ']' at the end (like when an MDI Child is maximized)

    Private Sub WorkHost_TextChanged(sender As Object, e As EventArgs) Handles MyBase.TextChanged
        If Me.Text.EndsWith("]") Then
            Me.Text = "Atlas Departure Control"
        End If
    End Sub

This did not have any effect as the MDI Child's name isn't actually shown in the form's Text property.

I also tried having a single button to change the text (in case of any timing issues when the form was maximized)

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Text = "Atlas Departure Control"
    End Sub

I am completely lost here and would appreciate any help I recieve.

Thanks!


Solution

  • You can set the Text of Child Form as string.Empty. This would remove the Child's title being shown in Main Title when maximized.

    childForm.Text = String.Empty