G
ginacresse
Hi,
I have a form (Form1) with a ContextMenuStrip (ContextMenuStrip1). If I
pass Form1 to a Utility Sub with the following code:
Public Sub Utility(theForm as Object)
with theForm
For Each MenuItem As ToolStripMenuItem In .ContextMenuStrip1.Items
If LCase(Strings.Left(MenuItem.Name, 8)) = LCase("tsmAudit") Then
MenuItem.Enabled = False
End If
Next
End With
End Sub
I get an error the ContextMenuStrip1 does not exist on Form1 -- but it does.
If I run this code in Form1 it works perfectly. Does anyone know why this
doesn't work and how I can accomplish what I'm trying to do?
Thanks,
I have a form (Form1) with a ContextMenuStrip (ContextMenuStrip1). If I
pass Form1 to a Utility Sub with the following code:
Public Sub Utility(theForm as Object)
with theForm
For Each MenuItem As ToolStripMenuItem In .ContextMenuStrip1.Items
If LCase(Strings.Left(MenuItem.Name, 8)) = LCase("tsmAudit") Then
MenuItem.Enabled = False
End If
Next
End With
End Sub
I get an error the ContextMenuStrip1 does not exist on Form1 -- but it does.
If I run this code in Form1 it works perfectly. Does anyone know why this
doesn't work and how I can accomplish what I'm trying to do?
Thanks,