mike586
mike586

Reputation: 3

vb.net form handling event from another form

In vb.net 2019, I have a form - 'form1' - that displays 'form2' (form2.Show()). form1 has the Systems.IO.Ports.SerialPort component added to it. How would I code form2 to 'handle' a serial port data receive event on form1?

Upvotes: 0

Views: 181

Answers (1)

gritware
gritware

Reputation: 81

Why not handle the event on Form1 where the control exists?

For example:

   Sub SerialPortDataReceiveEvent(DataReceiveObject)

      Form2.SomeProperty = DataReceiveObject.WantedProperty

   End Sub

Upvotes: 1

Related Questions