In looking at the evaluate statement for the button click event, why does the evaluate txtEmailAddress::text::IsValidEmail() produce an error selection object does not match selection subject. I put the set and evaluate validEmail in to show that it works. I was trying to combine statements like you can do in C#.
method-id btnSubmit_Click final private (sender as object e as type System.EventArgs).
local-storage section.
01 validEmail type System.Boolean.
* set validEmail = txtEmailAddress::Text::IsValidEmail()
* evaluate validEmail
local-storage section.
01 validEmail type System.Boolean.
* set validEmail = txtEmailAddress::Text::IsValidEmail()
* evaluate validEmail
evaluate txtEmailAddress::Text::IsValidEmail()
when true
//some code
when false
//some code
end-evaluate
end method.
when true
//some code
when false
//some code
end-evaluate
end method.
method-id IsValidEmail(s as string) returning validEmail as type Boolean extension
local-storage section.
try
declare mailAddress = new type System.Net.Mail.MailAddress(s)
set validEmail = true
catch
set validEmail = false
end method.
local-storage section.
try
declare mailAddress = new type System.Net.Mail.MailAddress(s)
set validEmail = true
catch
set validEmail = false
end method.