Using Serial Ports With The New Port Class?

Apr 24, 2010

I'm learning the serial port programming. So, I study the code samples from MSDN - VB101SamplesBCL2 http:[url].....While ran the solution of "UsingTheSerialPort", It shows error: It highlights one sentence textBox2.Text = SerialPort1.ReadLine() -- Line 40 ,and says :

"InvalidOperationException was unhandled - Cross-thread operation not valid: Control 'textBox2' accessed from a thread other than the thread it was created on."

View 1 Replies


ADVERTISEMENT

Read Method Of Serial Port Class

Feb 15, 2011

I have a problem with read() method of serial port class, when I build my program my application doesn't respond or blocked!!
My code was something like this:
dim bRxdata(6) as Byte
...
serialport1.read(bRxdta, 0, 6)
I use vb 2008 xpress, win7 x86.

View 4 Replies

.net - Recommendation For 3rd Party .NET Serial Port Class/Component?

Aug 10, 2010

I am looking for a serial port component for .NET that overcomes the issues with the built-in Serial Port component related to sudden unplugging of USB-to-RS232 adapters, and suspension of the computer while the port is open. (Untrappable errors occurring after the the device is unplugged or the computer comes back after being suspended.)I have been using Richard Grier's solution, but I still have problems when resuming from suspend.Is there a 3rd party component that you would recommend? I have tried several, and each have their shortcomings. Ideally I'd like a drop-in replacement for the standard serial port, but I'll take whatever I can get.

Edit: It turns out that upgrading to .NET 4 and using the serial class works fine on XP, but does not work on Windows 7.

View 2 Replies

Serial Port Added In One Form Not Accessible From Another Class?

Apr 19, 2011

I added a serial port com1 to my vb.net form. I created a new class and wrote a method to open the com1 and created its object in the main form and called the method and its opening.THen i created another class wrote a method to write data to the com and same way created an object and called it but i am getting the error as port is closed. What am i doing wrong.

View 1 Replies

Reading Serial Port Read Data From Serial Port?

Aug 16, 2011

i am a absolute beginner and i want to use vb to receive data from micro controller through serial port using rs232 standards, i found this code to receive the data serially, can any one tell me where should i paste this code, so that the data received will be displayed in message box.Private Sub DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) HandlesSerialPort1.DataReceived

[Code]...

View 9 Replies

Serial Port Example Code - Connect To A Modem Thru The Serial Port

Oct 26, 2011

The link below has code to connect to a modem thru the serial port but it is for an earlier version of VB. when I convert the code, it does not fully convert and has 4 errors that prevent building the project. can someone tell me what needs to be changed or added?

[URL]

Note: the error: not CLS-Compliant

View 8 Replies

Communication With Serial And TCP / IP Ports

Feb 19, 2009

What is the best way of communicating with Serial ports and TCP/IP communcation using vb.net?Using visual studio .net can we make it easier?? Can anyone send me sample application of communications?If I write a program communicating with my hardware using Searial port or TCP/IP, will the program be slow?? Are there any programming techniques working with communication ports?

View 1 Replies

Access A Serial And Parallel Ports?

Dec 20, 2010

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...

[Code]...

View 2 Replies

Make An Array Of Serial Ports In Vb?

Jun 6, 2011

I'm fairly new to Visual Basic (VB), but I've already got running code to access all my serial port. The problem is I want to load multiple serial ports into an array and loop through them in my functions. The program allows me to create ports(), but fails when I try to populate it.

Dim ports As IO.Ports.SerialPorts()
ports(0) = SerialPort1

Where SerialPort1 is an object I draged from the Visual Studio toolbox.

View 2 Replies

Open Two Or More Serial Ports In One VB 2008 Program?

Apr 20, 2009

able to open and utilize a single serial port within with my VB 2008 program (i.e., set port parameters, open&close port, send&receive data via port, etc.), but I want to open two or more serial ports concurrently within my VB 2008 program so that I can read data from one port, say COM1, make decisions and calculations based on that data, and send instructions out through another port, say COM2.

View 1 Replies

Read Data From Two Serial Ports At Same Time?

Aug 8, 2009

I am still new in programming. I am an electrical engineer. I have to read the time from GPS from one serial port apend this time to a data got from other device serially.

View 1 Replies

Sending Multiple Commands To A Serial Ports?

Aug 24, 2010

I am creating an application to configure some modems through the serial port. I have no problem sending a single string of data to the serial port and displaying the immediate response to a rich text box. I have 2 problems

1st: how to update the rich text box for any delayed response from the modem

2nd: how to react to the response from the modem, in other words I want to send the next command based on the response from the modem witch is usually "OK"

This is what my code looks like currently to send ans receive data from the serial port. (sport1 is my serial port and display is my rich text box)

sPort1.Write("AT+WOPEN=1" + Environment.NewLine)
With Display
.AppendText(sPort1.ReadExisting())

[Code].....

View 1 Replies

Update Combobox When Available Serial Ports Change

Dec 17, 2010

I want to know if there is a way to refresh a combo box when a new serial port becomes available.[code]

View 2 Replies

Unable To Close Serial Port After USB / Serial Converter Disconnected

Mar 28, 2006

I have a stand alone VB.Net 2005 application that uses a serial port that generally stays open while the application runs on a Windows XP system. In trying to bullet-proof the UI, I ran into a problem when the USB to Serial Converter normally used to provide the serial port is disconnected while the serial port is open. In trying to handle the resulting error when accessing the port, I find I cannot close the port.

When trying to do so, the error message says something like "unable to close the port. You may not have sufficient permissions." Reconnecting the USB/Serial Converter does not reactivate the port.

[Code]...

View 8 Replies

Read The Data From Barcode Weight Scales By Serial Port And TcpIp Port?

Nov 27, 2010

I'm mohammed from Oman ,I'm visual studio.net programmer How I can Read the Data From Barcode Weight scales By Serial port and TcpIp port

View 7 Replies

Get FullName From Available Serial Port (Com Port) From Device Manager In Windows Form With .net?

Jul 25, 2011

I have a Windows form.in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())for example( Com1,Com8,Com15,...).but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).how to Get it?

View 2 Replies

The Given Port Name Does Not Start With COM/com Or Does Not Resolve To A Valid Serial Port?

Aug 2, 2011

If I uninstall the COM1 and reboot, it works. If I shut down (power off) and restart, I get the message below. If I uninstall then click on Scan for Hardware Changes,The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name:portName

View 8 Replies

VS 2005 Use MSCOMM For Monitoring Serial Ports For Voltage Change?

Jul 22, 2009

I'm wondering how I could monitor a serial port for a voltage change or contact closure and have an event triggered when there is a detection.

View 1 Replies

Using Serial Ports - Take The Communication From The Software And Redistribute It To THREE Eurotherm 3216 Controllers?

Sep 7, 2009

I'm reasonably proficient with VB but never had any expirence with communicating with hardware. I have a piece of software that communicates with a Eurotherm 3216 process controller via RS232, but its use is fairly restricted what it can do.What I want to be able to do is take the communication from the software and redistribute it to THREE Eurotherm 3216 controllers, so my software would intercept the comms and effectively emulate the Eurotherm.

View 5 Replies

VS 2008 Create An Array Of Serial Ports - Deleting Dynamic Object

Jun 29, 2009

I have the following code to create an array of serial ports.

[Code]...

View 5 Replies

Show Valid Com Ports And Display Error If User Tries To Open Invalid Com Port?

Jul 9, 2009

I was wondering if its possible for VB to display all available COM ports that are open. he reason that I ask this is because this program will be run on various computers where the COM port will not always be the same. I have a text box now that the user can choose which com number he/she wants but if the wrong one is entered, the program crashes rather than displaying an error message. It would also be nice for the system to show which available com numbers there are

View 5 Replies

Communications :: Serial Port - Run Program, "Access To The Port 'COM1' Is Denied"?

Oct 15, 2008

Im having problem with the Serial Port. When i run my program, "Access to the port 'COM1' is denied". What does that mean? Im not sure whats happening because theres no error in my code. Someone suggest me to use 'COM2'. Which is also the same result. I have a microcontroller, programmed and run it. And i need to capture the data onto my vb, which is on a multiline textbox. How to i do that?Just to double check my code?

[code]...

View 1 Replies

Know Which Ip And Ports Are Supported By Webproxy Class?

Feb 15, 2009

I want to know which ip and ports are supported by webproxy class.. i used 127.123.123.124:2690 format.. only few ips are working out of 1000.. is there any way to get working one?

View 11 Replies

Write A Code For Serial Ports Without Sucess But The Code Does Not Throw An Error ?

Feb 20, 2011

what is wrong with my code and I get no feedback from my button click event, i have imported. ( code Below) and i have tied differrent combinations of the code without sucess.maybe add extra to my code for the list to show open Port or closed ports.

Imports System.Management
Imports System.Management.ManagementObjectSearcher
Imports System.Management.ManagementNamedValueCollection[code].....

View 9 Replies

Check On Serial Ports Is "breaking" USB Modem?

May 31, 2011

I am using the following code to enumerate through com ports to determine if the attached modems are in use.When I get to my usb modem, it returns the correct "PostIsAvailable" status, but then it kind of locks up the modem and I get the following error when I try to manually query the modem I get: "The modem failed to respond. Make sure it is properly connected and turned on. If it is an internal modem, or is connected, verify that the interupt for the port is properly set."I either have to manually requery the modem or unplug/plug it again.This code works fine on my external serial modem, but not the USB modem.

Public Function PortIsAvailable(ByVal port As String) As Boolean
Dim TempPort As New SerialPort
TempPort.PortName = port [code]......

View 5 Replies

VS 2008 - Get The Caption Property Of Serial Ports Available On Computer - Error "A First Chance Exception Of Type 'System.InvalidCastException"

Nov 12, 2009

In my project I'm trying to get the caption property of serial ports available on computer. But when I run this code below I get "A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll" exception. I tried putting "Option Strict On" and then I'm getting build error saying it disallows Late binding.

[Code]...

View 5 Replies

PrnAdmin.Ports Converting __ComObject To PrnAdmin.Port

Nov 6, 2008

I have written several classes that use System.Reflection to create xml serializable classes. I am currently working on on enumerating printer objects using PrnAdmin.dll. The PrnAdmin.Ports method returns as an object. When I enumerate through the ports I use the following code

Code:
Dim _Master as New PrnAdmin.PrintMaster
For each _Port as PrnAdmin.Port in _Master.Ports(ServerName)

[code]...

While debugging I put my mouse Over the _Port variable and it is represented as System.__ComObject instead of PrnAdmin.Port. Even when I use _Port as an Object and try to use CType to convert it to a PrnAdmin.Port it is still shown as a System.__ComObject.

My question is... How can I get the underlying type of a __System.ComObject so that I can expose PropertyInfo and MethodInfo members?

View 1 Replies

Serial Port Use In A DLL?

Jun 3, 2012

I am trying to buld a DLL in VB.NET 2010 that will be use to control a vending machine.Whin a call into the DLL to a function to open and setup the comport the first time its opens it just fine, but if a call into the DLL again it does not know that the port is open even if it is still open. I can check with another program and is shows the port is open and if I try to call into the DLL again to open the port I get an error that the port is already open. Any idea how to set this up so it will work

View 7 Replies

.net - Serial Port Communication?

Dec 30, 2009

i'm creating a windows form to send/receive data to/from serial port.At first : i send the data as string to the serial port .Second: i tried to read the string again for test the successfull transmission , but i recieved empty string

[Code]...

View 4 Replies

Accessing The Serial Port?

Oct 21, 2011

I can find documentation (preferably with code samples) that will guide me through all the steps to activate and read from a serial port?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved