How to make PictureBox to show in vb.net when it received data from arduino?

Hi guys :slight_smile:
I am having a hard time figuring how to make PictureBox show when TextBox1.Text received the "Alert Level 1".
VB.Net Code:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        SerialPort1.Open()
        Timer1.Start()


    End Sub
    

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim s As String
        Try
            s = SerialPort1.ReadLine
            TextBox1.Text = s

        Catch ex As Exception

        End Try

If (TextBox1.Text = "Alert Level 1") Then
            PictureBox1.visible = True
        ElseIf (TextBox1.Text = "No Alert Level") Then
            PictureBox1.visible = False
        End If
    End Sub
End Class

I am having a hard time figuring how to make PictureBox show when TextBox1.Text received the "Alert Level 1".

The code does something. Perhaps you'd care to explain what it does.

You want it to do something different, apparent.y What do you want it to do that is different from what it actually does?

Reading serial data using a timer is NOT the correct way. Look at the serial class. It has events that are triggered when serial data arrives. All you need to do is implement a handler.

http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
has example code for writing an event handler for the serial port

Within the event handler subroutine, you will put code to manipulate the picturebox.