• (3 Pages)
  • +
  • 1
  • 2
  • 3

Serial Port Communication in VB.Net Rate Topic: ****- 1 Votes

#1 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Post icon  Posted 13 November 2007 - 07:10 AM

Welcome to my tutorial on Serial Port Communication in VB.Net. Lately Ive seen a lot of questions on how to send and receive data through a serial port, so I thought it was time to write on the topic. Back in the days of Visual Basic 6.0, you had to use the MSComm Control that was shipped with VB6, the only problem with this method was you needed to make sure you included that control in your installation package, not really that big of a deal. The control did exactly what was needed for the task.

We were then introduced to .Net 1.1, VB programmers loved the fact that Visual Basic had finally evolved to an OO language. It was soon discovered that, with all it's OO abilities, the ability to communicate via a serial port wasn't available, so once again VB developers were forced to rely on the MSComm Control from previous versions of Visual Basic, still not that big of a deal, but some were upset that an intrinsic way of serial port communication wasn't offered with the .net Framework.

Then along comes .Net 2.0, and this time Microsoft added the System.IO.Ports Namespace, and within that was the SerialPort Class. DotNet developers finally had an intrinsic way of serial port communication, without having to deal with the complexities of interoping with an old legacy ActiveX OCX control. One of the most useful methods in the SerialPort class is the GetPortNames Method. This allows you to retrieve a list of available ports (COM1,COM2,etc.) available for the computer the application is running on.

Now that we have that out of the way, lets move on to programming our application. As with all application I create, I keep functionality separated from presentation, I do this by creating Manager classes that manage the functionality or a given process. What we will be looking at is the code in my CommManager class. As with anything you write in .Net you need to add the references to the Namespace's you'll be using:

Imports System
Imports System.Text
Imports System.Drawing
Imports System.IO.Ports
Imports System.Windows.Forms



In this application I wanted to give the user the option of what format they wanted to send the message in, either string or binary, so we have an enumeration for that, and an enumerations for the type of message i.e; Incoming, Outgoing, Error, etc. The main purpose of this enumeration is for changing the color of the text displayed to the user according to message type. Here are the enumerations:

#Region "Manager Enums"
''' <summary>
''' enumeration to hold our transmission types
''' </summary>
Public Enum TransmissionType
	Text
	Hex
End Enum

''' <summary>
''' enumeration to hold our message types
''' </summary>
Public Enum MessageType
	Incoming
	Outgoing
	Normal
	Warning
	[Error]
End Enum
#End Region



Next we have our variable list, 6 of them are for populating our class Properties, the others are being access throughout the manager class so they are made Global. Things are a bit different when sealing with delegates and how objects are access through VB.Net than they are in C#, so in the VB.Net version there are 2 more properties, and an extra Boolean variable used to determine if the buffer is to write the current data to the serial port. Here are the variables needed for the manager class:

#Region "Manager Variables"
'property variables
Private _baudRate As String = String.Empty
Private _parity As String = String.Empty
Private _stopBits As String = String.Empty
Private _dataBits As String = String.Empty
Private _portName As String = String.Empty
Private _transType As TransmissionType
Private _displayWindow As RichTextBox
Private _msg As String
Private _type As MessageType
'global manager variables
Private MessageColor As Color() = {Color.Blue, Color.Green, Color.Black, Color.Orange, Color.Red}
Private comPort As New SerialPort()
Private write As Boolean = True
#End Region



NOTE:I always separate my code into sections using the #region ... #end region to make it easier when scanning my code. It is a design choice so it's not necessary if you don't want to do it.

Now we need to create our class properties. All the properties in this class are public read/write properties. As stated above we needed to add 2 additional properties for the conversion from C# to VB.Net. We have properties for the following items:
  • Baud Rate: A measure of the speed of serial communication, roughly equivalent to bits per second.
  • Parity: The even or odd quality of the number of 1's or 0's in a binary code, often used to determine the integrity of data especially after transmission.
  • Stop Bits: A bit that signals the end of a transmission unit
  • Data Bits: The number of bits used to represent one character of data.
  • Port Name: The port with which we're communicating through, i.e; COM1, COM2, etc.
  • MessageType: Outgoing, Incoming, Error, Warning, etc.
  • Message: This is the actual message being sent through the serial port
We also have 4 properties that aren't related to the port itself, but with where the data will be displayed, what transmission type to use, the message type, and the message itself:

''' <summary>
''' property to hold the StopBits
''' of our manager class
''' </summary>
Public Property StopBits() As String
	Get
		Return _stopBits
	End Get
	Set(ByVal value As String)
		_stopBits = value
	End Set
End Property

''' <summary>
''' property to hold the DataBits
''' of our manager class
''' </summary>
Public Property DataBits() As String
	Get
		Return _dataBits
	End Get
	Set(ByVal value As String)
		_dataBits = value
	End Set
End Property

''' <summary>
''' property to hold the PortName
''' of our manager class
''' </summary>
Public Property PortName() As String
	Get
		Return _portName
	End Get
	Set(ByVal value As String)
		_portName = value
	End Set
End Property

''' <summary>
''' property to hold our TransmissionType
''' of our manager class
''' </summary>
Public Property CurrentTransmissionType() As TransmissionType
	Get
		Return _transType
	End Get
	Set(ByVal value As TransmissionType)
		_transType = value
	End Set
End Property

''' <summary>
''' property to hold our display window
''' value
''' </summary>
Public Property DisplayWindow() As RichTextBox
	Get
		Return _displayWindow
	End Get
	Set(ByVal value As RichTextBox)
		_displayWindow = value
	End Set
End Property

''' <summary>
''' Property to hold the message being sent
''' through the serial port
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Message() As String
	Get
		Return _msg
	End Get
	Set(ByVal value As String)
		_msg = value
	End Set
End Property

''' <summary>
''' Message to hold the transmission type
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Type() As MessageType
	Get
		Return _type
	End Get
	Set(ByVal value As MessageType)
		_type = value
	End Set
End Property
#End Region



To be able to instantiate any class object we create we need Constructors. Constructors are the entry point to your class, and is the first code executed when instantiating a class object. We have 2 constructors for our manager class, one that sets our properties to a specified value, and one that sets our properties to an empty value, thus initializing the variables preventing a NullReferenceException from occurring. We also add an EventHandler in the constructor, the event will be executed whenever there's data waiting in the buffer:

#Region "Manager Properties"
''' <summary>
''' Property to hold the BaudRate
''' of our manager class
''' </summary>
Public Property BaudRate() As String
	Get
		Return _baudRate
	End Get
	Set(ByVal value As String)
		_baudRate = value
	End Set
End Property

''' <summary>
''' property to hold the Parity
''' of our manager class
''' </summary>
Public Property Parity() As String
	Get
		Return _parity
	End Get
	Set(ByVal value As String)
		_parity = value
	End Set
End Property

#Region "Manager Constructors"
''' <summary>
''' Constructor to set the properties of our Manager Class
''' </summary>
''' <param name="baud">Desired BaudRate</param>
''' <param name="par">Desired Parity</param>
''' <param name="sBits">Desired StopBits</param>
''' <param name="dBits">Desired DataBits</param>
''' <param name="name">Desired PortName</param>
Public Sub New(ByVal baud As String, ByVal par As String, ByVal sBits As String, ByVal dBits As String, ByVal name As 

String, ByVal rtb As RichTextBox)
	_baudRate = baud
	_parity = par
	_stopBits = sBits
	_dataBits = dBits
	_portName = name
	_displayWindow = rtb
	'now add an event handler
	AddHandler comPort.DataReceived, AddressOf comPort_DataReceived
End Sub

''' <summary>
''' Comstructor to set the properties of our
''' serial port communicator to nothing
''' </summary>
Public Sub New()
	_baudRate = String.Empty
	_parity = String.Empty
	_stopBits = String.Empty
	_dataBits = String.Empty
	_portName = "COM1"
	_displayWindow = Nothing
	'add event handler
	AddHandler comPort.DataReceived, AddressOf comPort_DataReceived
End Sub
#End Region



The first think you need to know about serial port communication is writing data to the port. The first thing we do in our WriteData method is to check what transmission mode the user has selected, since binary data needs to be converted into binary, then back to string for displaying to the user. Next we need to make sure the port is open, for this we use the IsOpen Property of the SerialPort Class. If the port isnt open we open it by calling the Open Method of the SerialPort Class.

For writing to the port we use the Write Method. It is in this method we utilize the new boolean variable, write to determine if we want to write the data.This is used to handling byte transmission type when the data is in the incorrect format:

#Region "WriteData"
Public Sub WriteData(ByVal msg As String)
Select Case CurrentTransmissionType
	Case TransmissionType.Text
		'first make sure the port is open
		'if its not open then open it
		If Not (comPort.IsOpen = True) Then
			comPort.Open()
		End If
		'send the message to the port
		comPort.Write(msg)
		'display the message
		_type = MessageType.Outgoing
		_msg = msg + "" + Environment.NewLine + ""
		DisplayData(_type, _msg)
		Exit Select
	Case TransmissionType.Hex
		Try
			'convert the message to byte array
			Dim newMsg As Byte() = HexToByte(msg)
			'Determine if we are goint
			'to write the byte data to the screen
			If Not write Then
				DisplayData(_type, _msg)
				Exit Sub
			End If
			'send the message to the port
			comPort.Write(newMsg, 0, newMsg.Length)
			'convert back to hex and display
			_type = MessageType.Outgoing
			_msg = ByteToHex(newMsg) + "" + Environment.NewLine + ""
			DisplayData(_type, _msg)
		Catch ex As FormatException
			'display error message
			_type = MessageType.Error
			_msg = ex.Message + "" + Environment.NewLine + ""
			DisplayData(_type, _msg)
		Finally
			_displaywindow.SelectAll()
		End Try
		Exit Select
	Case Else
		'first make sure the port is open
		'if its not open then open it
		If Not (comPort.IsOpen = True) Then
			comPort.Open()
		End If
		'send the message to the port
		comPort.Write(msg)
		'display the message
		_type = MessageType.Outgoing
		_msg = msg + "" + Environment.NewLine + ""
		DisplayData(MessageType.Outgoing, msg + "" + Environment.NewLine + "")
		Exit Select
End Select
End Sub
#End Region



You will notice in this method we call three methods:
  • HexToByte
  • ByteToHex
  • DisplayData
These methods are required for this manager. The HexToByte method converts the data provided to binary format, then the ByteToHex converts it back to hex format for displaying. The last one, DisplayData is where we marshal a call to the thread that created the control for displaying the data, since UI controls can only be accessed by the thread that created them. First we'll look at converting the string provided to binary format:

#Region "HexToByte"
''' <summary>
''' method to convert hex string into a byte array
''' </summary>
''' <param name="msg">string to convert</param>
''' <returns>a byte array</returns>
Private Function HexToByte(ByVal msg As String) As Byte()
	'Here we added an extra check to ensure the data
	'was the proper length for converting to byte
	If msg.Length Mod 2 = 0 Then
		'remove any spaces from the string
		_msg = msg
		_msg = msg.Replace(" ", "")
		'create a byte array the length of the
		'divided by 2 (Hex is 2 characters in length)
		Dim comBuffer As Byte() = New Byte(_msg.Length / 2 - 1) {}
		For i As Integer = 0 To _msg.Length - 1 Step 2
			comBuffer(i / 2) = CByte(Convert.ToByte(_msg.Substring(i, 2), 16))
		Next
		write = True
		'loop through the length of the provided string
		'convert each set of 2 characters to a byte
		'and add to the array
		'return the array
		Return comBuffer
	Else
		'Message wasnt the proper length
		'So we set the display message
		_msg = "Invalid format"
		_type = MessageType.Error
		' DisplayData(_Type, _msg)
		'Set our boolean value to false
		write = False
		Return Nothing
	End If
End Function
#End Region



Here we convert the provided string to a byte array, then the WriteData method sends it out the port. For displaying we need to convert it back into string format, so we use the ByteToHex method we created:

#Region "ByteToHex"
''' <summary>
''' method to convert a byte array into a hex string
''' </summary>
''' <param name="comByte">byte array to convert</param>
''' <returns>a hex string</returns>
Private Function ByteToHex(ByVal comByte As Byte()) As String
	'create a new StringBuilder object
	Dim builder As New StringBuilder(comByte.Length * 3)
	'loop through each byte in the array
	For Each data As Byte In comByte
		builder.Append(Convert.ToString(data, 16).PadLeft(2, "0"c).PadRight(3, " "c))
		'convert the byte to a string and add to the stringbuilder
	Next
	'return the converted value
	Return builder.ToString().ToUpper()
End Function
#End Region



The last method that WriteData depends on is the DisplayData method. Here we use the Invoke Method of our RichTextBox, the control used to display the data, to create a new EventHandler which creates a new Delegate for setting the properties we wish for our message, then appending it to the value already displayed.

We had to change the format of the DisplayData method as VB.Net handles delegates completely different than C#. Instead of putting the functionality of the delegate in the method, we had to create a seperate method, then use the AddressOf Method to reference the procedure that will act as our delegate:

#Region "DisplayData"
''' <summary>
''' Method to display the data to and
''' from the port on the screen
''' </summary>
''' <remarks></remarks>
<STAThread()> _
Private Sub DisplayData(ByVal type As MessageType, ByVal msg As String)
	_displaywindow.Invoke(New EventHandler(AddressOf DoDisplay))
End Sub
#End Region



NOTE: You will notice that we have added the STAThreadAttribute to our method. This is used when a single thread apartment is required by a control, like the RichTextBox.

Now we will look at our delegate method, which is responsible for setting all of the properties of our display window,
which is a RichTextBox, as it has text formatting options not available to the regular TextBox:

#Region "DoDisplay"
Private Sub DoDisplay(ByVal sender As Object, ByVal e As EventArgs)
	_displaywindow.SelectedText = String.Empty
	_displaywindow.SelectionFont = New Font(_displaywindow.SelectionFont, FontStyle.Bold)
	_displaywindow.SelectionColor = MessageColor(CType(_type, Integer))
	_displaywindow.AppendText(_msg)
	_displaywindow.ScrollToCaret()
End Sub
#End Region



If you will read my tutorial on Serial Port Communication in C# you will see the same exact functionality that is in the DisplayData method, except in VB.Net, as pointed out earlier, requires the AddressOf Operator to reference a method to act as the delegate.The next method we will look at it used when we need to open the port initially. Here we set the BaudRate, Parity, StopBits, DataBits and PortName Properties of the SerialPort Class:

#Region "OpenPort"
Public Function OpenPort() As Boolean
	Try
		'first check if the port is already open
		'if its open then close it
		If comPort.IsOpen = True Then
			comPort.Close()
		End If

		'set the properties of our SerialPort Object
		comPort.BaudRate = Integer.Parse(_baudRate)
		'BaudRate
		comPort.DataBits = Integer.Parse(_dataBits)
		'DataBits
		comPort.StopBits = DirectCast([Enum].Parse(GetType(StopBits), _stopBits), StopBits)
		'StopBits
		comPort.Parity = DirectCast([Enum].Parse(GetType(Parity), _parity), Parity)
		'Parity
		comPort.PortName = _portName
		'PortName
		'now open the port
		comPort.Open()
		'display message
		_type = MessageType.Normal
		_msg = "Port opened at " + DateTime.Now + "" + Environment.NewLine + ""
		DisplayData(_type, _msg)
		'return true
		Return True
	Catch ex As Exception
		DisplayData(MessageType.[Error], ex.Message)
		Return False
	End Try
End Function
#End Region



Now that we have opened our port for communication for sending data through, we need to be able to close the port when we are finished without our application. Here we simply call the Close Method of the SerialPort Object, which also disposes of the internal stream being used for the data transmission:

#Region " ClosePort "
Public Sub ClosePort()
	If comPort.IsOpen Then
		_msg = "Port closed at " + DateTime.Now + "" + Environment.NewLine + ""
		_type = MessageType.Normal
		DisplayData(_type, _msg)
		comPort.Close()
	End If
End Sub
#End Region



Next lets take a look at our event handler. This event will be executed whenever there's data waiting in the buffer. This method looks identical to our WriteData method, because it has to do the same exact work:

#Region "comPort_DataReceived"
''' <summary>
''' method that will be called when theres data waiting in the buffer
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub comPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
	'determine the mode the user selected (binary/string)
	Select Case CurrentTransmissionType
		Case TransmissionType.Text
			'user chose string
			'read data waiting in the buffer
			Dim msg As String = comPort.ReadExisting()
			'display the data to the user
			_type = MessageType.Incoming
			_msg = msg
			DisplayData(MessageType.Incoming, msg + "" + Environment.NewLine + "")
			Exit Select
		Case TransmissionType.Hex
			'user chose binary
			'retrieve number of bytes in the buffer
			Dim bytes As Integer = comPort.BytesToRead
			'create a byte array to hold the awaiting data
			Dim comBuffer As Byte() = New Byte(bytes - 1) {}
			'read the data and store it
			comPort.Read(comBuffer, 0, bytes)
			'display the data to the user
			_type = MessageType.Incoming
			_msg = ByteToHex(comBuffer) + "" + Environment.NewLine + ""
			DisplayData(MessageType.Incoming, ByteToHex(comBuffer) + "" + Environment.NewLine + "")
			Exit Select
		Case Else
			'read data waiting in the buffer
			Dim str As String = comPort.ReadExisting()
			'display the data to the user
			_type = MessageType.Incoming
			_msg = str + "" + Environment.NewLine + ""
			DisplayData(MessageType.Incoming, str + "" + Environment.NewLine + "")
			Exit Select
	End Select
End Sub
#End Region



We have 3 small methods left, and these are actually optional, for the lack of a better word. These mthods are used to populate my ComboBoxe's on my UI with the port names available on the computer, Parity values and Stop Bit values. The Parity and Stop Bits are available in enumerations included with the .Net Framework 2.0:
#Region "SetParityValues"
Public Sub SetParityValues(ByVal obj As Object)
	For Each str As String In [Enum].GetNames(GetType(Parity))
		DirectCast(obj, ComboBox).Items.Add(str)
	Next
End Sub
#End Region

#Region "SetStopBitValues"
Public Sub SetStopBitValues(ByVal obj As Object)
	For Each str As String In [Enum].GetNames(GetType(StopBits))
		DirectCast(obj, ComboBox).Items.Add(str)
	Next
End Sub
#End Region

#Region "SetPortNameValues"
Public Sub SetPortNameValues(ByVal obj As Object)

	For Each str As String In SerialPort.GetPortNames()
		DirectCast(obj, ComboBox).Items.Add(str)
	Next
End Sub
#End Region



That is how you do Serial Port Communication in VB.Net. Microsoft finally gave us intrinsic tools to perform this task, no more relying on legacy objects. I am providing this class and a sample application to show how to implement what we just learned. What I am providing is under the GNU General Public License meaning you can modify and distribute how you see fit, but the license header must stay in tact. I hope you found this tutorial useful and informative, thatnk you for reading.

Happy Coding :)
Attached File  SerialPortCommunication_VBNet2.zip (223.7K)
Number of downloads: 33268

Is This A Good Question/Topic? 3
  • +

Replies To: Serial Port Communication in VB.Net

#2 Louisda16th  Icon User is offline

  • dream.in.assembly.code
  • member icon

Reputation: 15
  • View blog
  • Posts: 1,967
  • Joined: 03-August 06

Posted 18 November 2007 - 05:32 AM

Great tutorial PsychoCoder! :) Thanks. Just one tiny problem. For some reason, I cannot download the attachment.
Was This Post Helpful? 0
  • +
  • -

#3 SJH  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-July 08

Posted 28 July 2008 - 01:47 PM

Thanks for your excellent tutorial on serial communications in VB.NET. :^:

I wrote my own before coming across yours and while they both run, each has the same problem handling continuous data, i.e.- dropped characters (six to eight) about every 128 or so received.

Read somewhere that this was a bug in .Net. now going back to 2005 version. Have you heard anything?

/Steve
Was This Post Helpful? 0
  • +
  • -

#4 dbasnett  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 109
  • View blog
  • Posts: 603
  • Joined: 01-October 08

Posted 29 October 2008 - 08:27 AM

i just came across this. this is great for simple serial communications. however, if you use Blue Tooth serial devices to connect, which are capable of 1Mbps, you will find that the delegate method doesn't work well if you are transferring large volumes of data.

This post has been edited by dbasnett: 29 October 2008 - 08:28 AM

Was This Post Helpful? 0
  • +
  • -

#5 satishitagi@yahoo.com  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-December 08

Posted 09 December 2008 - 06:42 PM

[quote name='PsychoCoder' date='13 Nov, 2007 - 06:10 AM' post='278605']

Thank you for nice code example. It goes long way in training myself.
I was further interested to know whether can Web Forms of Visual Studio can also be used to address com ports of client machine?

When we write VB.Net code for Web form the web application can be compiled and client can access the pages produced by IIS through any internet explorer (preferrably IE). Instance of page is created by IIS and thrown to client machine as response and destroy the newly created page.

The page that is seen by client is a dead page, until any post back or form submit event is triggered by action of user. Such event is again reported to IIS and taking reference of page submitted IIS moves data to viewstate and calls code behind methods as per the context. Results are applied to viewstate data and new page is formed by IIS and thrown to the client and the new page is destroyed after throwing of the page to the client.

In this scenerio it is very difficult to address com ports of client computer. I want to know whether any facility is available to solve this problem?

Kindly help me out!!!
Was This Post Helpful? 0
  • +
  • -

#6 sweizone  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-November 08

Posted 05 January 2009 - 09:12 AM

Hi, I downloaded the rar file. when i unzipped it , the file it contains has no extension. I tried .cs, .vb & everythign i could think of. Still cant get what kinda file it is. can you pls help me out with the file. Thankyou in advance.
Was This Post Helpful? 0
  • +
  • -

#7 dimos8enis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 13-October 08

Posted 25 February 2009 - 09:20 AM

Hello, this was very usefull, thank you
I wrote a program that uses this class file but i have problems with virtual serial ports and I cannot open them. What's wrong?
and a question, is the communication synchronous? can i do it asynchronous? thank you
Was This Post Helpful? 0
  • +
  • -

#8 chuckfa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 18-March 09

Posted 22 March 2009 - 03:58 AM

The source file will not open. It appears the zip file is corrupted.

Thanks.

This post has been edited by chuckfa: 22 March 2009 - 04:12 AM

Was This Post Helpful? 0
  • +
  • -

#9 dagwin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-May 09

Posted 12 May 2009 - 10:29 PM

I was able to download the example zip (SerialPortCommunication_VBNet.zip) file but WinZip will not open the file.

Cannot open file: it does not appear to be a valid archive.

ADMIN: Please verify that the file is not corrupt.

Thank you
David
Was This Post Helpful? 0
  • +
  • -

#10 madhavjj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-May 09

Posted 30 May 2009 - 06:38 PM

Dear Sir,
The code file seems to have problem. When dowloaded and unzipped it has not extension and does not open in any program.

This is reported by few others also.

Any solutions please

Madhav Joshi
Was This Post Helpful? 0
  • +
  • -

#11 mahgoub  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-August 09

Posted 01 September 2009 - 11:12 PM

Serial Port Communication in VB.Net Example

Thank you for these useful code example. these what Iam training myself now .

but the source file will not open. It appears the zip file is corrupted

Please verify that the file is not corrupt
Was This Post Helpful? 0
  • +
  • -

#12 streamlinemm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-September 09

Posted 04 September 2009 - 02:43 AM

View Postmahgoub, on 1 Sep, 2009 - 10:12 PM, said:

Serial Port Communication in VB.Net Example

Thank you for these useful code example. these what Iam training myself now .

but the source file will not open. It appears the zip file is corrupted

Please verify that the file is not corrupt


Its not corrupt just use 7 zip its tripple packed.
Was This Post Helpful? 0
  • +
  • -

#13 walttoinifiniti  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-October 09

Posted 18 October 2009 - 01:51 PM

View Poststreamlinemm, on 4 Sep, 2009 - 01:43 AM, said:

View Postmahgoub, on 1 Sep, 2009 - 10:12 PM, said:

Serial Port Communication in VB.Net Example

Thank you for these useful code example. these what Iam training myself now .

but the source file will not open. It appears the zip file is corrupted

Please verify that the file is not corrupt


Its not corrupt just use 7 zip its tripple packed.


I really am trying to use the serial port in VB.net and wanted to play with this code,
I found and downloaded 7 zip. But as others have stated when it is unzipped, I don't have a clue what to do with it. I know this has been asked before, but can someone detail what has to be done to get this file to work using 7 zip? This would be greatly appreciated!
Was This Post Helpful? 0
  • +
  • -

#14 caprock  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-November 09

Posted 09 November 2009 - 10:00 AM

Excellen tutorial but can not unzip the package.

I downloaded the most recent 7zip but when extracted just has one file named the same as the archive but without the extent. Also, the filesize is same as the zip.

Does anyone have an idea as to un-archive this file?
Was This Post Helpful? 0
  • +
  • -

#15 kenbmobile  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-November 09

Posted 19 November 2009 - 01:27 AM

You da man... :^: :^: :^:
Awesome code segments and tutorial of a fundamentally important topic to hardware types and completely (up until you did it) un-addressed in any VB .Net books that I have seen (and of course unaddressed by MicroSoft).
Absolutely Great Job.
Oh... and like all the others have been saying; I can't extract the sample application, even with jZip which is supposed to be based on and fully supportive of 7-Zip files. Could I ask, on behalf of all of us, that you re-zip it in plain old WinZip so we can all be sure to be able to try it.
Thanks!! and great job again... ken
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3