Four Functions - October 1999

I recently began using the date picker that ships as part of VB 6 [maybe 5]. I am using the version supplied as part of the 'Microsoft Windows Common Controls-2 6.0' [mscomct2.ocx]. You will need to install this control if you want to run the demo. Sample date picker:

FourFunctions1Calendar.jpg (19039 bytes)

I am using the date picker on a form that allows the user to select a date using a pop-up calendar. While reviewing the code I 'rediscovered' four [actually 5] functions I thought may be useful to others. So these functions become the tip-of-the-month. Written in Coburg, Oregon while returning to LaQuinta, CA from Trip USA.

The Demo Program

I wrote a VB6 demo program to show how the four functions operate. The demo program:

FourFunctions.jpg (41518 bytes)

Using the Demo

FirstDayOfNextMonth - LastDayOfPriorMonth - Use the date picker to select a date. The last day of the prior month and first day of the next month are displayed, for example:

FourFunctions1.jpg (8735 bytes)

NotWeekend - One application I wrote prevented users from entering Saturdays or Sundays. I wrote NotWeekend to return the first Monday after the weekend. I then added an option that returns the Friday before the weekend, for example:

FourFunctions2.jpg (7394 bytes)

ForceUpperOrLowerCase - Sometimes we want users to enter all text in upper case. I used APIs GetWindowLong and SetWindowLong with parameter GWL_Style to force either all upper or all lower case, for example:

FourFunctions3.jpg (8541 bytes)

RemoveSpecialCharacters - I had an occassion to create a file name from text entered by the user. I discovered that certain special characters can not be included in file names - including long file names. So I wrote a routine to convert the special characters to one supplied to the function. In the following example special characters are converted to an underscore. Note, the function converts double spaces to singles:

FourFunctions4.jpg (14262 bytes)

The Demo Uses modConnectToWebSite

The demo program uses modConnectToWebSite.bas to display this page. For details on the use of that module click here.

Download VB Code

Click here to download the VB 6 Source Code [8k].

Previous Tip   Tip Index   Next Tip

Home

Updated 2000/10/29