VB.net Program to Demonstrate the Ioexception

You are currently viewing VB.net Program to Demonstrate the Ioexception

VB.Net program to demonstrate the IOException

'Vb.Net program to demonstrate the IOException.

Imports System.IO
Imports System.IO.Ports

Module Module1
    Sub Main()
            Dim data As String
            Dim serial As New SerialPort("COM1", 4800, Parity.Odd, 8, StopBits.One)
            data = serial.ReadLine()

        Catch ex As IOException
            Console.WriteLine("Exception: " & ex.Message)
        End Try
    End Sub
End Module
Exception: The port 'COM1' does not exist.
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply