473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Serial Comms and Inheritance

Hi,

I'm new to the world of Visual Studio .Net (but have done a fair bit
of VB6 coding). I'm playing with the sample RS232 code from the MSDN
website (http://msdn.microsoft.com/msdnmag/is.../default.aspx).

I'm trying to get to grips with inheritance and the examples in the
above, but have stumbled trying to do the following: From the code
available at the above link, I've got the examples working. I'm trying
to modify the code to make my own send/receive routine (with
appropriate timeouts, but thats to follow).

In the lineterm.vb file I've created the following:

Public Sub SendCommand(ByVal cmd As String)

t.Send(cmd)
While strReceived = ""
Application.DoEvents()
End While

...

which sends the command and waits for strReceived to get something in
it. strReceived should be loaded by the following:

Protected Overrides Sub OnRxLine(ByVal s As String)
strReceived = s
End Sub

(strReceived is a global string declared outside of the above two
routines)

If I step through the code (initially in the above while loop of the
SendCommand routine), then strReceived has nothing in it. Then I send
something serially and OnRxLine executes and strReceived has the
received string in it. However, if I then single step again, the next
time the code is in the while loop, strReceived is back to nothing
again.

I suspect I've missed something very basic (but very important) to do
with how the Overrides OnRxLine sub is executing and why the
strReceived variable is not shared between that and my SendCommand
routine.

Any help received with thanks.

Regards

Malcolm.
Nov 20 '05 #1
0 961

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: salsipius | last post by:
I can't figure this out, Please Help!!!! I would appreciate any remarks or opinions or help about the code below. A you can see I am writing and reading from the serial port, that is going OK...
2
by: M | last post by:
does c# or the .NET framework provide any serial communications support? where can i find some info on how to handle serial ports in c#? thanks m
3
by: Swatcat | last post by:
I have a device that send to my computer information by serial com port. The comunication parameters are: PORT: COM 1 Bits per second: 9600 Data bits: 8 Parity: None (0) Stop bits:1 How...
0
by: Karl | last post by:
Hi, I've been trying for some time to establish reliable serial comms for a 4-port system, i.e. with the two regular COM1 and COM2 on the motherboard and with a dual PCI serial card (COM3 and...
2
by: K.K. | last post by:
I am writing program that will recieve or sent data to selected port (users can select which port they want to recieve or sent) but I don't know how or whick object I can use.
4
by: H J van Rooyen | last post by:
Hi All, I am writing a polling controller for an RS-485 line that has several addressable devices connected. It is a small access control system. All is well- the code runs for anything from...
38
by: shussai2 | last post by:
Hi, I am trying to access Serial Port in XP. I am using Dev-C++ IDE that uses Mingw as a compiler. I just want to know how I can open up serial port on COM1 and write some data. I have searched...
0
by: sgarcia22 | last post by:
Hello all, I workin on a windows application and it requires communicating using serial ports. The application only has one form called Form1. When I use the serial ports in the Form1.cs file...
4
by: adlloyd | last post by:
Hi all, I've got an application that's written in C++ making use of MFC (VS6). Its purpose is to process SMS messages received from a GSM modem connected via a serial port (USB connection). The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.