AddHandler: refer to dynamically created object in the Handler

  • Thread starter Thread starter ino_mart
  • Start date Start date
I

ino_mart

Guest
All

I have a RibbonDropDownList which I created dynamically and to which I added a Handler

AddHandler rbZebrix.SelectionChanged, AddressOf cboZebrix_TextChanged

Public Sub cboZebrix_TextChanged()
msgbox("You changed the value in the DropDownList")
end sub

This works as expected. When I run the program and I select another value in the dropdownlist, the messagebox does appear.

I also want to show the selected value in the msgbox. It thought this would be simple by changing the AddHanlder and the code into

AddHandler rbZebrix.SelectionChanged, AddressOf cboZebrix_TextChanged(rbZebrix)

Public Sub cboZebrix_TextChanged(rb as RibbonDropDown)
msgbox("You changed the value in the DropDownList to: " & rb.ToString)
end sub

However, this ends op in the error "AddressOf" operand must be the name of a method (without parentheses)

So how can I solve this?

Regards
Ino

Continue reading...
 
Back
Top