how to register Date and Time Picker thru code

G

Guest

Hi,
I'm using the MS Date and Time Picker Control 6.0.

Is any way to check if it's registered (MSCOMCT2.OCX) on a user machine and
if not to copy and register it programmatically (VB) during the form or app
downloading?
 
G

Guest

Use FileSystemObject to see if the file is there. If it is not, copy it and
register it with a bat file that contains the following 2 lines:

xcopy mscomct2.ocx c:\windows\system32\mscomc2.ocx
regsvr32 /s MSCOMCT2.OCX
 
G

Guest

Thanks, Cheryl.

Could you please clarify how I could use this FileSystemObject and how I
could generate that bat file?

For now I'm using the API-only approach Stephen Lebans has at
http://www.lebans.com/monthcalendar.htm

It's working well. But, sometimes I'm getting the error message:
"YOu must instantiate the MonthCalendar Class object before you call this
function The code behind the sample Form shows you how to do this in the
Form's Load event
This must appear here!
Create an instance of our Class
Private Sub Form_Load()
Set mc = New clsMonthCal
You must set the class hWndForm prop!!!
mc.hWndForm = Me.hWnd"
 
G

Guest

Dim fs As FileSystemObject
Set fs = New FileSystemObject
If Not fs.FileExists("c:\windows\system32\mscomc2.ocx") Then
Shell App.Path & "\regmscomc2.bat"
End If

This would assume that regmscomc2.bat is in the same path as the program you
are running and has these two lines in it
You'll have to put your copy of mscomct2.ocx in a location where it can be
copied from.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top