It doesn't work because that is not VB - it's C#.
Try using a online translator such as
Code Converter C# to VB and VB to C# – Telerik[
^]
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim sp As SerialPort = New SerialPort()
sp.PortName = "COM1"
sp.BaudRate = 9600
sp.Parity = Parity.None
sp.DataBits = 8
sp.StopBits = StopBits.One
sp.Open()
sp.WriteLine(" ")
sp.WriteLine("Hi welocme here")
sp.Close()
sp.Dispose()
sp = Nothing
End Sub
It you are going to blindly copy and paste code, you need to check what language it is in before trying to use it ...