Salut,
J'ai créé un menu strip qui contient 2 menus item. Chaque menu est permis(enabled)pour un utilisateur(selon son type)et disabled pour l'autre.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 Private Sub utilisateurs_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        Dim connection As New SqlClient.SqlConnection
        connection.ConnectionString = ""
        Dim cmd As New SqlClient.SqlCommand
        Dim condition1 As Boolean = Convert.ToBoolean("SELECT * FROM Agent WHERE ID_type= 1100 or ID_type= 1200")
        Dim condition2 As Boolean = Convert.ToBoolean("SELECT * FROM Agent WHERE ID_type= 1300 ")
        connection.Open()
        cmd.CommandText = "select ID_type FROM Agent"
        cmd.Connection = connection
        If condition1 = True Then
            GestionArchivesBureauPostalToolStripMenuItem.Enabled = True
            GestionArchivesAdministratifsToolStripMenuItem.Enabled = False
 
        ElseIf condition2 = True Then
            GestionArchivesBureauPostalToolStripMenuItem.Enabled = False
            GestionArchivesAdministratifsToolStripMenuItem.Enabled = True
 
        End If
        connection.Close()
    End Sub
à l'exécution un message d'erreur s'affiche:
La chaîne n'a pas été reconnue en tant que Boolean valide.
Merci