hi all ,
i wrote a class that send and receives data from serial port .
the class uses serialport class. now I have a event handler that is being called when the incoming buffer has data. I also have a parsing method in my class.

my problem is that i want to show the parsed data on a textbox on my form.
the thing is that i cant access form1.textbox1 because its private, and i cant call the public parsing method from form1 because its an event.

i'm feeling its a common problem about passing data between classes
how do i do it ?

thanks
Zvika

Recommended Answers

All 2 Replies

Have the constructor in your serial port class take in a TextBox (and have a private TextBox field to hold the object). When you instantiate your serial port class in Form1, pass in the TextBox from your form.

thanks jonsca,
not exactly what i had in mind but i used it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.