disable toolstrip on mdi form

I have a mdi form named Mdi parent.
I have a separate registration form that shows a countdown of the date since installation.
What I want is for the toolstrip on the mdiparent form to disable at the expiration date so the user cannot use the program until it's registered.

I have the code on the registration screen. It is supposed to call the mdiparent form.
I know it's a collection but I don't want to call each button and Not sure that it would work either.
Public Class frmRegister

    Private Sub frmregister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        frmMain.Button1.PerformClick()
         lblCustRef.Text = SL.Reference
        Dim Days_Used As Short


          If Is_Registered() Then
            ExpireLab.Text = "This software is registered"

       '  Insert code to display the program here
            process()
         Else
 Days_Used = Is_Expired()
 If Days_Used = -1 Then
     ExpireLab.Text = "Your 30 Day Trial has Expired.You must register to continue."
     ExpireLab.ForeColor = System.Drawing.Color.Crimson
' HERE is where I want the mdiparent toolstrip to be disabled. I can't seem to get it to work. The mdiparent gets a null reference when I run the code.

  Else
ExpireLab.Text = Str$(Days_Used) & " days of a 30 day trial."
 End If

  On Error GoTo 0
 Exit Sub
    End Sub

    Sub process()

        
        'MdiParent.Enabled = True
     ' MdiParent.Visible = True
       
 Me.Close()
    End Sub

Open in new window

LVL 1
mindserveAsked:
Who is Participating?
 
ashishgamre11Commented:
Try this:

        MdiParent.Visible = True
        MdiParent.Visible = True
        MdiParent.ToolStrip.Enabled = False
0
 
greg wardSystems EngineerCommented:
fMainForm.Toolbar1.Enabled = False
 
Greg
0
 
mindserveAuthor Commented:
I get the error message "Toolstrip is not a member of system windows forms on MdiParent.ToolStrip.enabled=false
  MdiParent.Visible = True
            MdiParent.Visible = True
            MdiParent.ToolStrip.Enabled = False

and for Greg I get the error FMainform is not declared.
fMainForm.Toolbar1.Enabled = False

I have tried MdiParent.ToolStrip.enabled=false and that also produces an error message.

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mindserveAuthor Commented:
Error      1      'ToolStrip' is not a member of 'System.Windows.Forms.Form'.      
I added System.Windows.Forms.Form to the form and still get the error message.
0
 
ashishgamre11Commented:
       MdiParent.Visible = True
        MdiParent.Visible = True
        MdiParent.ToolStrip.Enabled = False



-------->>>>>> MdiParent.ToolStrip.Enabled = False

Replace 'ToolStrip' by the name of your toolstrip.
0
 
mindserveAuthor Commented:
Toostrip is the name of the toolstrip...:(
I have tried the following:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/00c8700a-75e8-4457-ae94-fa2d0b3b19c4

Been looking around the net and it appears that this is an issue.
0
 
mindserveAuthor Commented:
The code was correct  but I did have some other issues with calling the toolstrip from another form.
0
 
mindserveAuthor Commented:
Imports System.Windows.Forms.ToolStrip
Imports System.Windows.Forms.Form

Public Class frmRegister
    Inherits System.Windows.Forms.Form

I had to import the forms.toolstrip and then it worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.