Indu mathy

Indu mathy

  • NA
  • 3
  • 0

serial communication (plz help)

Jul 12 2009 9:39 AM
I have written code in VS 2008 VB.NetMy for sending a character from one PC to another PC through RS232 i want tat character to be sent also i should receive character form tat PC.

first i am testing this within PCs,once tat works then PocketPC(Windows Mobile 5.0 OS) to PC communication will work surely.
but iam still not getting from PC to PC itself..

SO PLZ HELP ME SIR.....


I have written a program in VB.NET 2008

but I am getting an error as

"An unhandled exception of type System.InvalidOperationException occurred in System.dll
Additional Information: The basestream is only available when the port is open "


Iam using .Net Framework2.0--->Visual Basic--->Device application

the code tat i presently use is::



Imports System.IO.Ports
Imports System.IO.Ports.Serialport

If Button1.Text Is "open port" then
SerialPort1.Open()
Button1.Text="close port"
Button2.Enabled=True

Else If Button1.Text Is "close port" then
SerialPort1.Close()
Button1.Text="open port"
Button2.Enabled=False

End If

SerialPort1.WriteLine(Textbox1.Text)
Listbox1.Items.Add("sent:" +TextBox1.Text)


ListBox1.Items.Add("Received" +Serialport1.ReadLine())



Thanking U in advance

Regards
Indu