Hi

I want to link my program in vb6 to the system calendar in windows XP by using shell but to be able to do that i need to know the default path or file location of the system calendar ( i was searching all day and still didnt find out what it is)

so i read some where there is a built in calendar in vb? if there can some one give me a link to a tutorial about it

or tell me the path of the system calendar?

Thanks
Note: Am still a beginner in visual basic

Forgot to mention i want to let the calendar appear in a click of a button in vb6 i tried doing this by using shell

Private Sub Command1_Click()
Shell "C:\WINDOWS\system32\MSCAL.OCX"
End Sub

(i took the path from ActiveX Control of Microsoft Calender Control 11.0)

but when i run this command it gives me

Run-time Error '5':
Invalid procedure call or argument

Well not sure how to do what you are wanting but the intrinsic date and time functions can change the systems date and time. Start a new project and add the code and run.

Option Explicit

Private Sub Form_Load()
Debug.Print Date
Debug.Print Time

Date = DateAdd("d", 1, Date)
Time = DateAdd("n", 1, Time)

Debug.Print Date
Debug.Print Time

Date = DateAdd("d", -1, Date)
Time = DateAdd("n", -1, Time)

Debug.Print Date
Debug.Print Time
End Sub

Good Luck

If you are looking to interact with it then my suggestion is that you use the inbuilt calendar of vb6....

else here is the code

Private Sub Command1_Click()
    '~~> launces the date time window in control panel
    Call Shell("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl")
End Sub

I want to link my program in vb6 to the system calendar in windows XP by using shell but to be able to do that i need to know the default path or file location of the system calendar ( i was searching all day and still didnt find out what it is)

Option Explicit

Private shl as Shell

Private Sub Form_Load()
     Set shl = New Shell
End Sub

Private Sub Command1_Click
     shl.SetTime
End Sub

You need to add the Microsoft Shell Controls and Automation reference in the Projects/Reference Menu. That will bring up the System Calendar. Is that what you're referring to?

Hi hkdani, you don't need to "Microsoft Shell Controls and Automation reference" to just tackle the "date time window" in control panel. The code that I gave above is good enough :)

The code that I gave above is good enough

You're right. The way I mentioned is an alternate way of doing it. I realized that after I posted. :icon_redface:

The code may look easier (shl.SetTime) , but the executable will be larger because of adding the shell libaries.

Give Koolsid the thumbs up.:icon_wink:

Be a part of the DaniWeb community

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