vb.net - trigger an event from another control -


i'm using vb.net , winform. coming across issue i'm pounding head against past few hours.

i have main usercontrol added groupbox , inside groupbox, added control this:

main usercontrol

me.groupbox1.controls.add(me.ctlwithdropdown) 

user control ctlwithdropdown

me.controls.add(me.ddlist)  private sub ddllist_selectionchanged(byval sender object, byval e system.eventargs) handles ddllist.selectionchanged 'some simple logic here check if value changed          end sub 

the main usercontrol inherits base class has event set value true or false so:

 public event setflag(byval value boolean) 

i want know how can trigger/set boolean value dropdownlist when selectionchanged event trigger. on issue?

wire event handler drop down list:

addhandler me.ctldropdown.selectedindexchanged, addressof ddlselectedindexchanged me.groupbox1.controls.add(me.ctldropdown) 

make sure create ddlselectedindexchanged in control , have fire setflag event:

protected sub ddlselectedindexchanged(byval sender object, byval e eventargs)     raiseevent setflag(true)  end sub 

Comments

Popular posts from this blog

Why does Go error when trying to marshal this JSON? -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

python - Pygame. TypeError: 'pygame.Surface' object is not callable -