jarlathreidy
March 27th, 2001, 07:07 AM
My program should send either a 1, 2, 3 or 4 to the serial port depending on whether volume +/- or channel +/- is selected. This is the code. It worked fine until I included the Communication code for channel up and channel dn. Please help. I'm using the enterprise version so I dont know why it doesn't work. Thanks.
Jarlath.
option Explicit
Dim S as Integer
private Sub frmRemote_load()
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End Sub
private Sub cmdSpacebar_KeyPress(KeyAscii as Integer)
Timer.Enabled = false
Timer.Interval = 3000
Timer.Enabled = true
S = S + 1
If S = 5 then
S = 0
End If
If S = 1 then
lblStatus2.Caption = S
Image1.Visible = true
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End If
If S = 2 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = true
Image3.Visible = false
Image4.Visible = false
End If
If S = 3 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = true
Image4.Visible = false
End If
If S = 4 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = true
End If
If S = 0 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End If
End Sub
private Sub Timer_Timer()
If S = 1 then
lblStatus2.Caption = "Volume increasing"
Timer.Enabled = false
End If
If S = 2 then
lblStatus2.Caption = S
lblStatus2.Caption = "Volume decreasing"
End If
'output test for ch+ and ch- only
If S = 3 then
lblStatus2.Caption = S
lblStatus2.Caption = "Channel Up"
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = true
MSComm1.Output = 3
'"ATDT555-1234" & vbCr
MSComm1.PortOpen = false
End If
If S = 4 then
lblStatus2.Caption = S
lblStatus2.Caption = "Channel Dn"
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = true
MSComm1.Output = 4
MSComm1.PortOpen = false
End If
'Attempt1
S = 0
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
Timer2.Enabled = true
End Sub
private Sub Timer2_Timer()
lblStatus2.Caption = S
Timer2.Enabled = false
End Sub
Jarlath.
option Explicit
Dim S as Integer
private Sub frmRemote_load()
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End Sub
private Sub cmdSpacebar_KeyPress(KeyAscii as Integer)
Timer.Enabled = false
Timer.Interval = 3000
Timer.Enabled = true
S = S + 1
If S = 5 then
S = 0
End If
If S = 1 then
lblStatus2.Caption = S
Image1.Visible = true
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End If
If S = 2 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = true
Image3.Visible = false
Image4.Visible = false
End If
If S = 3 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = true
Image4.Visible = false
End If
If S = 4 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = true
End If
If S = 0 then
lblStatus2.Caption = S
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
End If
End Sub
private Sub Timer_Timer()
If S = 1 then
lblStatus2.Caption = "Volume increasing"
Timer.Enabled = false
End If
If S = 2 then
lblStatus2.Caption = S
lblStatus2.Caption = "Volume decreasing"
End If
'output test for ch+ and ch- only
If S = 3 then
lblStatus2.Caption = S
lblStatus2.Caption = "Channel Up"
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = true
MSComm1.Output = 3
'"ATDT555-1234" & vbCr
MSComm1.PortOpen = false
End If
If S = 4 then
lblStatus2.Caption = S
lblStatus2.Caption = "Channel Dn"
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = true
MSComm1.Output = 4
MSComm1.PortOpen = false
End If
'Attempt1
S = 0
Image1.Visible = false
Image2.Visible = false
Image3.Visible = false
Image4.Visible = false
Timer2.Enabled = true
End Sub
private Sub Timer2_Timer()
lblStatus2.Caption = S
Timer2.Enabled = false
End Sub