I'm developing a module where I need to take input from a user one of each is users email. In order to filter out a wrong input I want to check if a corresponding checkbox
has an @
sign.
Does anyone knows how can I check it using vb.net
?
I'm developing a module where I need to take input from a user one of each is users email. In order to filter out a wrong input I want to check if a corresponding checkbox
has an @
sign.
Does anyone knows how can I check it using vb.net
?
Aside the main question to check if a string contains the @
character and considering that you are getting your string from a user input, in your case I think is better to check if the user entered a valid mail address.
To do so there are some solutions all reported in this other SO question How do I validate email address formatting with the .NET Framework?
In ASP.NET you can use RegularExpressionValidator
for this.
<asp:RegularExpressionValidator ID="regexEmailValid" runat="server"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ControlToValidate="tbEmail"
ErrorMessage="Invalid Email Format">
</asp:RegularExpressionValidator>