COM ports connection issues

i am working on a project to send an sms using asp.net to a mobile conncted to my computer. I will not ask how to do it. i want someone to help me to find my COM port numbers

i tried 1. Device manger > ports (com&lpt) problm : THERE IS NO PORTS(COM&LPT) in the list in devicemanger.

  1. i tried programatically i got this code

    imports System.IO.Ports
    
    Private Shared Sub SendSampleData()
     ' Instantiate the communications
     ' port with some basic settings
     Dim port As New SerialPort("COM1", 9600, Parity.None, 8, StopBits.One)
    
     ' Open the port for communications
     port.Open()
    
     ' Write a string
     port.Write("Hello World")
    
     ' Write a set of bytes
     port.Write(New Byte() {&Ha, &He2, &Hff}, 0, 3)
    
     ' Close the port
     port.Close()
    End Sub
    

    and franckly speaking i do not kn0w how to input the phone number in it.

Can some1 please help me to acheive my goal ?

Upvotes: 0

Views: 179

Answers (1)

Dai
Dai

Reputation: 155005

If Device Manager says that your computer doesn't have any serial ports then you need to make sure that your system can detect the serial ports in the first place.

...assuming your computer has a serial port. Does it?

If it does (and I assume it does) then it's probably disabled in BIOS. You need to go into your computer's BIOS or EFI firmware at startup and enable the serial ports.

Also, never hardcode the serial port name in your code, e.g. "COM1", instead use SerialPort.GetPortNames() to get a list of available ports on your computer and let your users choose from the list.

Upvotes: 1

Related Questions