lothos12345 Posted October 5, 2005 Posted October 5, 2005 I have developed a Visual Basic.NET application that connects to a sql database. The application queries the database for data in a specific column/cell. This data can either be a fax number or and email address (keeping in mind that an e-mail address can be a mixture of both letters and numbers), is there a way that I can have the application tell the difference between e-mail and fax. So if the data pulled is a fax number it the application sends the information to our fax server, and if its an email address the application sends the information to our email server. The application needs to tell the difference. The fax number can be in any format from (210) 777-1234 to 210-777-1234 or 777-1234. The email address will always be in the following format "test123@test.com". A visual basic.net programming example of how to accomplish this would greatly be appreciated or any help for that matter. Quote
techmanbd Posted October 5, 2005 Posted October 5, 2005 here is something simple Dim str As String = strTheDataStringComapredOfFaxOrEmail Dim i As Integer = str.IndexOf("@") If i > 0 Then 'do whatever for email else 'do something for fax End If Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Leaders snarfblam Posted October 5, 2005 Leaders Posted October 5, 2005 Of course, you probably want to verify that either the e-mail of fax number is in a valid format. I would just check for and "@" followed by a "." and invalid characters for the e-mail and check that a phone number only contains digits (or letters if you want to allow them), parentheses, and dashes and spaces (and periods if you want to allow a format like "555.555.5555"). Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.