I would like to make a custom control for phone numbers but I'm not quite sure how to do this. I'm a C# man myself by my new employer likes the VB
flavor, so I'm pretty new to this whole VB
side of things.
I want a phone number label that displays a formatted phone number. Currently in the databases they tend to store formatting with the numbers, which is ghetto. I want the presentation tier to provide all formatting in our future apps and I want to pull all of that formatted trash out of our databases.
So I guess for this one I'd like the format to look something like:
+1 (999) 999-9999
If there were no country prefix I want it to just display:
If there is an extension I want it to show that too:
(999) 999-9999 Ext. 999
All I have so far is my properties. Would I overload the Text property in the parent class?
In our database we typically store the area code, and number together. So the text that would be bound to this control would typically be a ten character string of numbers. So that confuses me. I can bind the country prefix to a new property I made called countryPrefix because thats stored in its own column in the database. Same goes for the extension number (in most cases). However the area code, and 7-digit number are typically stoted in one column in the database. So I cant just bind that to any one property because its really three properties....
I might be just over complicating this. Any advice or help anyone could provide would be greatly appreciated!
Public Class PhoneNumberTextBox
Private _countryPrefix As String
Private _areaCode As String
' In a telephone network the first three numbers of what we typically
' refer to as a "telephone number", is called the "exchange number"
Private _exchangeNumber As String
Private _customerNumber As String
Private _extensionNumber As String
Public Property countryPrefix()
_countryPrefix = value
Public Property areaCode()
_areaCode = value
Public Property exchangeNumber()
_exchangeNumber = value
Public Property customerNumber()
_customerNumber = value
Public Property extensionNumber()
_extensionNumber = value
School of Medicine
University of Missouri Columbia