Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enable/Disable Menu item
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00414768
Message ID:
00414771
Vues:
27
>How could I enable/disable the Menu item(s).
>
>Eg: frmMDIForm.mnuTransaction.Enable = True (will turn on)
>
>But I have store all the menu items name in a Table, so that
>I can use a loop to assign the access rights to the items.
>
>My Table contain the following fields:
>ItemName Normal Manager
>---------------------------------------------------------
>frmMDIForm.mnuTransaction.Enable True True
>frmMDIForm.mnuReport.Enable False True
>
>If a user having the MANAGER rights, I would use a WHILE loop
>to set the Menu item to True/False.
>
>I tried the following code, but couldn't achieve it.
>
>Trim(rsAcessTable!ItemName) & " = " & ("!" & strAccessCode)
>
>strAccessCode = stores (NORMAL or MANAGER) taken from Staff Table.
>
>In VB6, is there something like &strAccessCode (like in VFP, will
>run the content).

Try the above code without frmMDIForm.
Just:
mnuTransaction.Enable = True

There is no macro substitution in VB. Here is an example of simulated macro substitution:

Dim oCtrl As ScriptControl
Dim vVal As Variant, msText As String
Set oCtrl = New ScriptControl
oCtrl.Language = "VBScript"
msText = "Now"
vVal = oCtrl.Eval(msText)
MsgBox vVal
George
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform