Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro Substitution in VB
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00150101
Message ID:
00150315
Vues:
21
>If I follow you right, you want to disable TextBoxes 1 - 10. The following VB code is an example of a form with TextBox controls and one command button. When you click the button, the code cycles through each control on the form to disable/enable any that are of the type TextBox.
>
>Private Sub Command1_Click()
>Dim MyControl As Control
>
>With Command1
>If .Caption = "Disable" Then
> .Caption = "Enable"
>Else
> .Caption = "Disable"
>End If
>End With
>
>For Each MyControl In Form1.Controls
> If TypeOf MyControl Is TextBox Then
> MyControl.Enabled = Not MyControl.Enabled
> End If
>Next
>
>End Sub
>
>Just let me know if you want to get more specific, such as you want to disable controls given a certain name, etc...
>
>Regards,
>Jack Mendenhall
>Reinsurance Management, Inc.

Jack,
Actually I have a table called Permissions. It has the following fields

-UserID - User's ID
-FormName - Form name containing the menu
-MenuName - The actual name of the menu
-Allowed - True or False, the permission granted to the user

I want to disable the menus of the form i am loading depending on the permissions given to the user. I want to do it the following way, this is VB code:

datPermission.Recordset.MoveFirst
cFind = "UserID = '" & cID & "' and FormName = '" & Screen.Activeform.Name
cForm = Screen.Activeform.Name

datPermission.Recordset.FindFirst cFind
Do While Not datPermission.Recordset.EOF
' Here is why i want to do macro substitution:
cMenu = datPermission.Recordset("MenuName")

'FoxPro code would look like this. How do I do it in VB
&cForm..&cMenu..Visible = datPermission.Recordset("Allowed")
datPermission.Recordset.FindNext cFind
Loop

I would really appriciate your help

Thanks
Abdul Ahad
Abdul Ahad Khan
CSi
www.csi-pk.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform