It seems I am either missing something or there is a serious flaw.
I am setting Label1.Text to a variable then I am calling a sub to check what the text of the label is.
If it is 0 then "yes" should appear
If it is 1 then "no" should appear.
Instead the Else function happens no matter what.
It is like It does not tell there is a match.
I have tried TextChange too
I even added .ToString to the end, no dice.
no luck
I am setting Label1.Text to a variable then I am calling a sub to check what the text of the label is.
If it is 0 then "yes" should appear
If it is 1 then "no" should appear.
Instead the Else function happens no matter what.
It is like It does not tell there is a match.
I have tried TextChange too
I even added .ToString to the end, no dice.
no luck
Code:
Option Explicit On
Imports System.IO
Imports System.Net.Sockets
Public Class Form1
Dim Listener As New TcpListener(8000)
Dim Client As TcpClient
Dim Message As String
Private Sub _Load() Handles MyBase.Load
Timer1.Start()
TimerMLGCheck.Start()
Listener.Start()
FunTime()
End Sub
Private Sub _FormClosing() Handles Me.FormClosing
Listener.Stop()
End Sub
Public Sub _Tick() Handles Timer1.Tick
Dim nStart As Integer
Dim nLast As Integer
If Listener.Pending = True Then
Message = ""
Client = Listener.AcceptTcpClient()
Dim Reader As New StreamReader(Client.GetStream())
While Reader.Peek > -1
Message &= Convert.ToChar(Reader.Read()).ToString
End While
If Message.Contains("</>") Then
nStart = InStr(Message, "</>") + 4
nLast = InStr(Message, "<\>")
Message = Mid(Message, nStart, nLast - nStart)
End If
Label1.Text = Message
ActivateHorn()
End If
End Sub
Private Sub Label1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
If Label1.Text.ToString = "0" Then
MsgBox("yee")
ElseIf Label1.Text.ToString = "1" Then
MsgBox("job")
End If
End Sub
Public Sub ActivateHorn()
If Label1.Text.ToString = "0" Then
MsgBox("yes")
ElseIf Label1.Text.ToString = "1" Then
MsgBox("no")
Else
BasicAirhorn()
End If
End Sub
Sub BasicAirhorn()
My.Computer.Audio.Play(My.Resources.Airhorn,
AudioPlayMode.Background)
End Class