I have used Windows 'Your Phone' app to connect my phone to my PC. I have written some code in VB .Net so that when a contact's phone number is displayed on the PC screen it also appears in a mini web browser as a hyperlink so when it is clicked the number is sent to my mobile phone's dialler to save me having to re-key it. Here is the code that generates the hyperlink:

WebBrowser1.DocumentText = "<a href = 'tel:" & myPhoneNumber.Replace(" ", "") & "'>" & myPhoneNumber & "</a>"

The basic functionallity works, but I have two questions:
1) Is there a better way of displaying the hyperlink, rather than in a separate web browser panel? Can I send it to a Rich Text Box? Can I define a hyperlink in the middle of teh existing normal text box?

2) If the incoming string is just the phone number (i.e only numeric digits) it works ok (e.g. myPhoneNumber = "02085 555 555") but if someone has added a name to the text box it fails (i.e. "02085 555 555 - ask for Jim" or "02085 555 555 / 07999 999 999"). Is there a recommended way of pulling phone numbers out of a string? At the moment all I can do to validate the incoming string, is to check it is 11 characters long, and that it is numeric.

1) I think what you're looking for is a LinkLabel

2) I think you need to re-think how you're getting the phone numbers entered. You should validate the numbers at the source.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.