I am trying to use lambdas in some VB.Net code, in fact, I am trying to set a flag when calling databound.
A simplified expression looks like this:
Dim dropdownlist As New DropDownList()
dropdownlist.DataSource = New String() {"one", "two"}
Dim databoundCalled As Boolean = False
AddHandler dropdownlist.DataBound, Function(o, e) (databoundCalled = True)
dropdownlist.DataBind()
My understanding is that the databoundCalled variable should be set to true, it is clear that I am missing something, since the variable always remains false.
What do I need to do to fix this?
source
share