Ouvrir/fermer les ports avec visuel et checkbox

Description

Bonjour,
Cette source consiste a ouvrir des ports com, 1,2,3,4. elle a une interface visuelle, des check box.
Elle peut servir a allumer des lumières depuis l'ordi grace a un transistor.

Source / Exemple :


Private Sub Command1_Click()
    If Option1.Value = True Then
        If MSComm1.PortOpen = True Then
            MsgBox "Port déja ouvert"
        Else
            MSComm1.PortOpen = True
                 Pov.Visible = True
                 Po.Visible = True
                 Pfr.Visible = False
                  Pf.Visible = False
            
            
        End If
        End If
        
 If Option2.Value = True Then
        If MSComm2.PortOpen = True Then
            MsgBox "Port déja ouvert"
        Else
            MSComm2.PortOpen = True
                   Pov.Visible = True
                   Po.Visible = True
                   Pfr.Visible = False
                   Pf.Visible = False
        End If
        End If
 If Option3.Value = True Then
        If MSComm3.PortOpen = True Then
            MsgBox "Port déja ouvert"
        Else
            MSComm3.PortOpen = True
                Pov.Visible = True
                Po.Visible = True
                Pfr.Visible = False
                Pf.Visible = False
        End If
        End If

 If Option4.Value = True Then
        If MSComm4.PortOpen = True Then
            MsgBox "Port déja ouvert"
        Else
            MSComm4.PortOpen = True
                Pov.Visible = True
                Po.Visible = True
                Pfr.Visible = False
                Pf.Visible = False
        End If
        End If

End Sub

Private Sub Command2_Click()
 If Option1.Value = True Then
        If MSComm1.PortOpen = False Then
            MsgBox "Port déja fermé"
        Else
            MSComm1.PortOpen = False
                Pov.Visible = False
                Po.Visible = False
                Pfr.Visible = True
                Pf.Visible = True
        End If
        End If

 If Option2.Value = True Then
        If MSComm2.PortOpen = False Then
            MsgBox "Port déja fermé"
        Else
            MSComm2.PortOpen = False
                Pov.Visible = False
                Po.Visible = False
                Pfr.Visible = True
                Pf.Visible = True
        End If
        End If

 If Option3.Value = True Then
        If MSComm3.PortOpen = False Then
            MsgBox "Port déja fermé"
        Else
            MSComm3.PortOpen = False
                Pov.Visible = False
                Po.Visible = False
                Pfr.Visible = True
                Pf.Visible = True
        End If
        End If
        
 If Option4.Value = True Then
        If MSComm4.PortOpen = False Then
            MsgBox "Port déja fermé"
        Else
            MSComm4.PortOpen = False
                Pov.Visible = False
                Po.Visible = False
                Pfr.Visible = True
                Pf.Visible = True
        End If
        End If
End Sub

Conclusion :


Merci de noter ma source et d'ajouter d'éventuels Comentaires

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.