vb.net - Event from other class -
i have "catch" event class can't. project contains 2 forms: form1 , form2 , class params. form 1 contain 1 button have change property value in class props. , form2 have know when props raises event.
here situation:
''form1 code public class form1 dim p new params private sub form1_load(byval sender object, byval e system.eventargs) handles me.load form2.show() end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click p.demo = "mytry" end sub end class ''form2 code public class form2 private withevents p params private sub pchanged(byval propertyname string) handles p.propchanged messagebox.show(propertyname) end sub end class ''class params code public class params public event propchanged(byval propname string) private _demo string public property demo() string return _demo end set(byval value string) _demo = value raiseevent propchanged("demo") end set end property end class
problem sub pchanged in form2 never fired , have fired when property "demo" raises event propchanged.
how working?
you have 2 params
variables , handling wrong in form2
if change property in form1
. handle event in form2
, raise again handle in form1
.
one here:
public class form1 dim p new params
and 1 here
public class form2 private withevents p params
note have use withevents p new params
in form1
if want handle event there.
Comments
Post a Comment