Giusto per fare i raffinati... direi di esplicitare il cast...
Originariamente inviato da x69asterix
codice:MSComm1.CommPort = CInt(Combo1.Text)
Giusto per fare i raffinati... direi di esplicitare il cast...
Originariamente inviato da x69asterix
codice:MSComm1.CommPort = CInt(Combo1.Text)
Amaro C++, il gusto pieno dell'undefined behavior.
Dove sbaglio....![]()
-------------
Private Sub Combo1_Change()
MSComm1.PortOpen = False
MSComm1.CommPort = CInt(Combo1.Text)
MSComm1.Settings = "9600,n,8,1"
MSComm1.RThreshold = 1
On Error Resume Next
MSComm1.PortOpen = True
If Err Then
MsgBox.Caption = "Impossibile aprire la COM" & MSComm1.CommPort & vbCrLf & Error$
End If
On Error GoTo 0
End Sub
-----------
Private Sub Form_Load()
For i = 1 To 6
Combo1.AddItem i
Next
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.RThreshold = 1
On Error Resume Next
MSComm1.PortOpen = True
If Err Then
MsgBox.Caption = "Impossibile aprire la COM" & MSComm1.CommPort & vbCrLf & Error$
End If
On Error GoTo 0
End Sub
--------
Private Sub Form_Terminate()
MSComm1.PortOpen = False
End Sub
----------
Private Sub AV_Mute_Off_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox.Caption = ""
MSComm1.Output = Chr$(77) & Chr$(85) & Chr$(84) & Chr$(69) & Chr$(32) & Chr$(79) & Chr$(70) & Chr$(70) & Chr$(13)
End Sub
grazie...![]()
ieri che diventa oggi, non ritornerà domani....
Piu' che altro bisognerebbe sapere che errore ti da' per dirti dove sbagli, e poi la porta non puo' essere chiusa se prima non e' stata aperta e viceversa, pena la generazione di errore.
...and I miss you...like the deserts miss the rain...
Originariamente inviato da Daniel79
[....]
Non c'è un modo per inserire nella combobox solo le porte com effettivamente presenti sul computer???
codice:With MSComm1 combo1.Clear For s = 1 To 255 Err.Clear If .PortOpen = True Then .PortOpen = False On Error Resume Next .CommPort = s .PortOpen = True If Err.Number = 0 Then combo1.AddItem Trim(CStr(s)) End If .PortOpen = False Next s End With
...and I miss you...like the deserts miss the rain...
ciao a tutti
ho provato lo script di vonkranz... e tutto funge,non mi genera neanche un errore,
ho utilizzato la routine click anziche cghange dell'oggetto combo, l'opeazione è corretta o dovrei utilizzare un'altra routine?
grazie a tutti per la collaborazione....![]()
ieri che diventa oggi, non ritornerà domani....