7 Replies - 341 Views - Last Post: 24 November 2017 - 01:22 AM Rate Topic: -----

#1 [email protected]  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 16-May 17

How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 05:38 AM

Sir
Please help me about MenuStrip Control used.
I create a project there one parents form and two child form
MenuStripControl-1 is on parents form (main_form)
Menu Item name a) Trans. b)Report c) Setting

and
MenuStripControl-2 is on child form (purchase_Entry_Form)
Menu Item name a) File. b)Close
I want to when start the application (parents form (main_form)) then show MenuStripControl-1 menu Items only.
But
when run the child form (purchase_Entry_Form) then show MenuStripControl-2 menu Items only.
After closing child form(purchase_Entry_Form) then re show the parents form (main_form) MenuStripControl-1 menu Items only.

It is possible
please help me sir...

What I have tried:

If i Hide the MenuStripControl-1 the automatically hide MenuStripControl-2

Is This A Good Question/Topic? 0
  • +

Replies To: How to us hide menustripcontrol-1 and show menustripcontrol-2

#2 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1464
  • View blog
  • Posts: 3,713
  • Joined: 01-February 13

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 08:10 AM

Why do you need to hide either of the menus? If they are added to two different forms you would not see the second menu unless the second form is shown.
Was This Post Helpful? 0
  • +
  • -

#3 [email protected]  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 16-May 17

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 11:30 AM

I don't want to show the main form menu. I want to show only the active form menu
Please Help me to solved the problems
Please Help me......
Was This Post Helpful? 0
  • +
  • -

#4 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1464
  • View blog
  • Posts: 3,713
  • Joined: 01-February 13

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 12:17 PM

I just want to make sure i understand what you want to do before giving you any suggestions...

Do you mean that you have 2 menus that are both on the main form and you want to show/hide one or the other on the main form?
Was This Post Helpful? 0
  • +
  • -

#5 KhaosFury  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 24-November 14

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 12:53 PM

How about on each Load event of the forms put:

        If purchase_Entry_Form.Visible = True Then
            MenuStripControl-2.Visible = True
            MenuStripControl-2.Dock = DockStyle.Top
            MenuStripControl-1.Visible = False
        Else
            MenuStripControl-1.Visible = True
            MenuStripControl-1.Dock = DockStyle.Top
            MenuStripControl-2.Visible = False
        End If



I haven't tried it, but let me know how that looks.
Was This Post Helpful? 0
  • +
  • -

#6 [email protected]  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 16-May 17

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 20 November 2017 - 10:29 PM

View PostIronRazer, on 20 November 2017 - 12:17 PM, said:

I just want to make sure i understand what you want to do before giving you any suggestions...

Do you mean that you have 2 menus that are both on the main form and you want to show/hide one or the other on the main form?


Yes Sir. Please Help me
Thanks I am not good in English. Please forgive me
Was This Post Helpful? 0
  • +
  • -

#7 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1464
  • View blog
  • Posts: 3,713
  • Joined: 01-February 13

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 21 November 2017 - 04:23 AM

Well, i am just guessing at how your second form is being created and shown so, i am just using a ToolStripItem's Click event to do that in this example. You will need to implement that code in the event that you use to open the second form.

Basically, i just added two MenuStrips to the Main Form (Form1) and set their Visible properties to hide one and show the other. See if it helps.
Public Class Form1
    Private WithEvents f2 As Form2 = Nothing

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MenuStrip_ChildForm2.Visible = False 'hide the menustrip for the child form when the main form is loading
    End Sub

    Private Sub f2_Closed(sender As Object, e As EventArgs) Handles f2.Closed
        f2 = Nothing 'set f2 to Nothing when it has been closed
        MenuStrip_ChildForm2.Visible = False 'hide the child menu
        MenuStrip_MainForm.Visible = True 'show the main menu
    End Sub

    Private Sub OpenForm2ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OpenForm2ToolStripMenuItem.Click
        If f2 Is Nothing Then 'if Form2 (f2) is not opened and Shown yet then...
            f2 = New Form2 'create the new instance of Form2
            f2.Show(Me) 'show the new instance of Form2
            MenuStrip_ChildForm2.Visible = True 'hide the main menu
            MenuStrip_MainForm.Visible = False 'show the child menu
        End If
    End Sub
End Class


Was This Post Helpful? 0
  • +
  • -

#8 [email protected]  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 16-May 17

Re: How to us hide menustripcontrol-1 and show menustripcontrol-2

Posted 24 November 2017 - 01:22 AM

View PostKhaosFury, on 20 November 2017 - 12:53 PM, said:

How about on each Load event of the forms put:

        If purchase_Entry_Form.Visible = True Then
            MenuStripControl-2.Visible = True
            MenuStripControl-2.Dock = DockStyle.Top
            MenuStripControl-1.Visible = False
        Else
            MenuStripControl-1.Visible = True
            MenuStripControl-1.Dock = DockStyle.Top
            MenuStripControl-2.Visible = False
        End If



I haven't tried it, but let me know how that looks.



All Menu strip are Hide
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1