my pc's operating system
windows 7 ultimate 32 bit
-------------------------
login access: username & password - admin
i am working on a project that will control 5 devices through pc parallel port/printer port.
when i run the program it will first appear a loginform
then when i enter.
it always returns that the port doesnt exist.
even though i have the port it cant detect it.. i dont know what is wrong with my code.
--------------------------------------------------------
Dim FILE_NAME As String = "LPT1"
If System.IO.File.Exists(FILE_NAME) Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write("hi")
objWriter.Close()
MsgBox("ok")
Else
MsgBox("port does not exist")
End If
------------------------------------------------------
then after the login the next form is homepage. there you'll see the switch buttons that will turn on and off a device. when i clicked any of this buttons an error will prompt. its say that object reference not set to an instance of an object
NullReferenceException was unhandled.
Private Sub btn_app1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app1.Click
If btn_app1.Text = "ON" Then
btn_app1.Text = "OFF"
btn_app1.BackColor = Color.Red
io(0)
Else
btn_app1.Text = "ON"
btn_app1.BackColor = Color.Green
io(1)
End If
End Sub
Private Sub btn_app2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app2.Click
If btn_app2.Text = "ON" Then
btn_app2.Text = "OFF"
btn_app2.BackColor = Color.Red
io(0)
Else
btn_app2.Text = "ON"
btn_app2.BackColor = Color.Green
io(2)
End If
End Sub
Private Sub btn_app3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app3.Click
If btn_app3.Text = "ON" Then
btn_app3.Text = "OFF"
btn_app3.BackColor = Color.Red
io(0)
Else
btn_app3.Text = "ON"
btn_app3.BackColor = Color.Green
io(4)
End If
End Sub
Private Sub btn_app4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app4.Click
If btn_app4.Text = "ON" Then
btn_app4.Text = "OFF"
btn_app4.BackColor = Color.Red
io(0)
Else
btn_app4.Text = "ON"
btn_app4.BackColor = Color.Green
io(8)
End If
End Sub
Private Sub btn_app5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app5.Click
If btn_app5.Text = "ON" Then
btn_app5.Text = "OFF"
btn_app5.BackColor = Color.Red
io(0)
Else
btn_app5.Text = "ON"
btn_app5.BackColor = Color.Green
io(16)
End If
End Sub
Private Sub io(ByVal bit As Integer)
val = axHwinterface1.InPort(888)
axHwinterface1.OutPort(888, CShort(val Or bit))
End Sub
--------------------------------------------------------
please help me im new in this.. i need your help guys.. thank you in advance..
every response is very much appreciated
if you want to see my whole project you can Download it here
http://www.mediafire.com/?1zvx1ty736r2nnb
windows 7 ultimate 32 bit
-------------------------
login access: username & password - admin
i am working on a project that will control 5 devices through pc parallel port/printer port.
when i run the program it will first appear a loginform
then when i enter.
it always returns that the port doesnt exist.
even though i have the port it cant detect it.. i dont know what is wrong with my code.
--------------------------------------------------------
Dim FILE_NAME As String = "LPT1"
If System.IO.File.Exists(FILE_NAME) Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write("hi")
objWriter.Close()
MsgBox("ok")
Else
MsgBox("port does not exist")
End If
------------------------------------------------------
then after the login the next form is homepage. there you'll see the switch buttons that will turn on and off a device. when i clicked any of this buttons an error will prompt. its say that object reference not set to an instance of an object
NullReferenceException was unhandled.
Private Sub btn_app1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app1.Click
If btn_app1.Text = "ON" Then
btn_app1.Text = "OFF"
btn_app1.BackColor = Color.Red
io(0)
Else
btn_app1.Text = "ON"
btn_app1.BackColor = Color.Green
io(1)
End If
End Sub
Private Sub btn_app2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app2.Click
If btn_app2.Text = "ON" Then
btn_app2.Text = "OFF"
btn_app2.BackColor = Color.Red
io(0)
Else
btn_app2.Text = "ON"
btn_app2.BackColor = Color.Green
io(2)
End If
End Sub
Private Sub btn_app3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app3.Click
If btn_app3.Text = "ON" Then
btn_app3.Text = "OFF"
btn_app3.BackColor = Color.Red
io(0)
Else
btn_app3.Text = "ON"
btn_app3.BackColor = Color.Green
io(4)
End If
End Sub
Private Sub btn_app4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app4.Click
If btn_app4.Text = "ON" Then
btn_app4.Text = "OFF"
btn_app4.BackColor = Color.Red
io(0)
Else
btn_app4.Text = "ON"
btn_app4.BackColor = Color.Green
io(8)
End If
End Sub
Private Sub btn_app5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_app5.Click
If btn_app5.Text = "ON" Then
btn_app5.Text = "OFF"
btn_app5.BackColor = Color.Red
io(0)
Else
btn_app5.Text = "ON"
btn_app5.BackColor = Color.Green
io(16)
End If
End Sub
Private Sub io(ByVal bit As Integer)
val = axHwinterface1.InPort(888)
axHwinterface1.OutPort(888, CShort(val Or bit))
End Sub
--------------------------------------------------------
please help me im new in this.. i need your help guys.. thank you in advance..
every response is very much appreciated
if you want to see my whole project you can Download it here
http://www.mediafire.com/?1zvx1ty736r2nnb