July 22, 2000

Self-aware Data Wrapper Objects with VB

f you’re one of the thousands of programmers out there writing server-side business components, then youve probably used data wrappers: light-weight objects designed to access streamed data. The following article builds on the traditional wrapper concept to create self-aware objects, which offer the added benefits of simplicity and re-use. As

IsValidPhoneField – Check whether a phone number is valid

‘ Validate attributes of Phone data’ Returns True if valid, False if invalid” Also returns the phone in formatted fashion (USA format).’ Will convert alphabetics to numeric”Example:’ If IsValidPhoneField(Value:=”3034414444″, ReformattedPhone:=strNewPhone,’ ‘ IsRequired:=True, IsUSAPhone:=True) then …Function IsValidPhoneField(ByVal Caption As String, Value As Variant, _ ReformattedPhone As String, Optional ByVal IsRequired As

IsValidCreditCardNumber – Check whether a credit card number is valid

‘ Validate a credit card numbers’ Returns True if valid, False if invalid” Example:’ If IsValidCreditCardNumber(Value:=”1234-123456-12345″, IsRequired:=True)Function IsValidCreditCardNumber(Value As Variant, Optional ByVal IsRequired As _ Boolean = True) As Boolean Dim strTemp As String Dim intCheckSum As Integer Dim blnDoubleFlag As Boolean Dim intDigit As Integer Dim i As Integer

MSExcel – A class for writing Excel spreadsheets

‘***********************************************************’* Module Name: MSExcel’* Author: Steve Miller’* Date: 11/22/98’* Description: Encapsulates and eases the chore of writing to an Excel ‘ spreadsheet.’*’* IMPORTANT: requires that you have a reference to Excel type library’*’* Example: Here is an example of how to use this class:’* Dim objXL As New ttExcel.Application ‘Instantiate

The beginning or end of previous week

For reporting, many times you need to figure out what date last week began and ended. Use the code below to figure that out: Dim vntBegin As variantDim vntEnd As variantConst constSunday As Integer = 1GetPriorWorkWeek BeginDayOfWeek:=constSunday, WeekBegin:=vntBegin, _ WeekEnd:=vntEndPrint “Begin of Week: ” & vtnBegin & “, End of

Send HTML Email via CDO

Ever wonder how to send email that looks like a web page? Here is how you do it. Note: You must have CDO for NT referenced for this to work. ‘Sends an email to the appropriate person(s).”From = Email address being sent from’SendTo = List of email addresses separated by

Sending Email Using CDO and MAPI

Sending emails via code used to be cool, but now it is a necessity. Below is code to send email via CDO. If the CDO call fails, it will send using MAPI. NOTE: You must have CDO for NT referenced in your project for this to work. ‘ Sends an

IsValidDateField – Check whether a date is valid

Enum psDateTypes AnyValidDate ‘Allows any valid date to be entered PastDate ‘Only allows past dates (before today) to be entered FutureDate ‘Only allows future dates (after today) to be entered TodayOrFuture ‘Only allows today or future date to be entered TodayOrPast ‘Only allows today or a previous day to be

IsValidSSN – Check a Social Security Number value

‘ Validates attributes of the SSN’ Returns True if valid, False if invalid”Example:’ If IsValidSSN(Value:=”333-44-3333″, IsRequired:=True) then …Function IsValidSSN(ByRef Value As String, Optional ByVal IsRequired As Boolean _ = True) As Boolean On Error GoTo ErrorHandler Dim strTemp As String Dim i As Integer Dim intMax As Integer IsValidSSN =

No more posts to show