Brian, Ben, Eric;
I see what you are saying. Obviously, this whole OO thing is new and
confusing to me, as I tend to think of a serial port as a resource ANYTHING
should be able to work with.
Anyhow, the reason I am trying to add serial port access to the method that
refreshes my graph is that it seems to be a "looping" process (i.e. if I run
the app in debig mode and just step through, it continually comes back to the
paint function) and I need something like this to continually update the
graph. However, when I tried this in my main form, I (obviously!) lock up the
app, as once it starts sending & receiving serial data, it stops responding
to anything else. So, how do I write a loop that also looks for a specific
button click to break out of it? I could not find any way to write code that
says something like, "If you see that this button was clicked, break out of
this loop"
The help files in the Visual C# have been virtually useless to me, as pretty
much every single isue with which I have had problems either has not been
addressed, or may have been, but I just couldn't phrase the query correctly
to find the answer. This forum is about th eonlyplace I've found help, and I
appreciate it very much!
Anyhow, what I want to be able to do is click a button, which starts the
loop that does the serial port interface, and if click the same button again,
will break out of the loop and just go back to the main function. The first
part has been easy - I have an event handler that calls th eloop when I click
the button, but once th eloop starts, I haven't found anything that lets me
get out gracefully.
TIA for the help!
"davetelling" wrote:
I'm a newbie that is still struggling with OOP concepts & how to make things
work they way I want. Using Visual C# Express, I have a form in which I added
a user control to display a graph, based upon data received via the serial
port. If I run the serial port in the main form code, I can get data and,
using public properties of the user control, transfer the data to be shown on
the graph. However, I am trying to add a feature that will poll the external
device via the serial port and update the graph within the user control.
However, when I try to add a serial port command (such as
serialPort1.WriteLine()) within the user control code I get an error:
"The name 'serialPort1' does not exist in the current context"
How do I make the serial port control "visible" to my user control?
Thanks,
Dave T.