Results 1 to 3 of 3

Thread: serial port

  1. #1
    conquerors is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2010
    Posts
    1
    Reputation
    0

    serial port

    is there any other way to access a serial port using visual basic.net 2010? i followed the steps in this site, How to access serial and parallel ports by using Visual Basic .NET but i just got this output

    Open the serial port.
    Send the attention command to the modem.
    Wait for data to come back to the serial port...

    and stopped there. i can't get the

    Read the OK response data in the serial port.
    Close the serial port.

    and i was thinking, because it is very much easy to access serial port in vb6, so can i just use vb6 and then connect to visual basic.net? it is like a language inside a language. would that be possible? thank you much.

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,451
    Reputation
    2727
    That article is very old, click the link in first line where is says "For a Microsoft Visual Studio 2005 version of this article, see 904795" to see an example using the SerialPort class.
    You would also need to configure the baud rate etc if the connected equipment uses different than default settings. The data sent and received depends on the protocol of the connected equipment.

  3. #3
    erupter is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2010
    Posts
    12
    Reputation
    49
    Accessing the serial port is really simple.
    Just create an object instantiating from System.IO.Ports.SerialPort
    Then you can configure it to open the preferred com, set the baudrate, send and receive messages.
    As JohnH already told you, you can thus send and receive data, what then is written in that data depends on the protocol used.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking