G
Guest
Good morning,
Still new at this so please bear with me. I am creating a table dynamically
using webcontrols based on the output of a sproc from my database.The table
represents test instances that the test proctor who is viewing the page has
currently assigned to him or heir. Each row of the table corresponds to a
single test instance and includes required info about that test.
At the end of the row I create a button control. Based on whether or not the
test is currently active, this button will either allow the user to activate
the test or change the test date.
This all works fine, up to the point of using the AddHandler. Here is the
button code:
dim newBtn as new Button()
'Text, class assignment, etc.
if bIsActive = true then
AddHandler newBtn.Click, AddressOf change_test_date
else
AddHandler newBtn.Click, AddressOf activate_test
end if
So ok, this works, except I have to pass the test number with this event to
make sure the correct test is addressed and updated. I tried
AddHandler newBtn.Click, AddressOf change_test_date(objReader("test_num"))
But I get the following error:
'AddressOf' operand must be the name of a method; no parentheses are needed.
The question is how do I pass the test number as an argument for this event?
I am sure its something simple, but I can't find it. Any help would be really
appreciated. Thanks in advance.
Jim Hawley
Still new at this so please bear with me. I am creating a table dynamically
using webcontrols based on the output of a sproc from my database.The table
represents test instances that the test proctor who is viewing the page has
currently assigned to him or heir. Each row of the table corresponds to a
single test instance and includes required info about that test.
At the end of the row I create a button control. Based on whether or not the
test is currently active, this button will either allow the user to activate
the test or change the test date.
This all works fine, up to the point of using the AddHandler. Here is the
button code:
dim newBtn as new Button()
'Text, class assignment, etc.
if bIsActive = true then
AddHandler newBtn.Click, AddressOf change_test_date
else
AddHandler newBtn.Click, AddressOf activate_test
end if
So ok, this works, except I have to pass the test number with this event to
make sure the correct test is addressed and updated. I tried
AddHandler newBtn.Click, AddressOf change_test_date(objReader("test_num"))
But I get the following error:
'AddressOf' operand must be the name of a method; no parentheses are needed.
The question is how do I pass the test number as an argument for this event?
I am sure its something simple, but I can't find it. Any help would be really
appreciated. Thanks in advance.
Jim Hawley