Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calender control

Status
Not open for further replies.

cossiboon

Programmer
Dec 12, 2000
25
US
Has anybody used the MSCTLCOM2.DTPicker.2 control?

I can't get it to work! This is my CFObject code :

<CFOBJECT action=&quot;CREATE&quot; class=&quot;MSComCtl2.DTPicker.2&quot; name=&quot;dtp&quot; type=&quot;COM&quot;>

HELP!!!

s-)
 
I haven't used the MSCTLCOM2.DTPicker.2 control yet, but I am fairly familiar with CF and COM. What problem do you run in to? Please be more specific so I can try to help.

<webguru>iqof188</webguru>
 
First off, I am still learning coldfusion. The object is created, but it doesn't display. I guess I don't know how to initialize the object. Does this help at all?

Any ideas would be helpful... Thanks
 
Have you got any code to show? Please specify how you create the object and how you try to instantiate it.

<webguru>iqof188</webguru>
 
This is part of a form to create a new expense for a project.
I don't know how much this will help, but here it is:

<CFFORM action=&quot;NewExpense.cfm&quot; method=&quot;POST&quot; name=&quot;newexpense&quot;>

<td align=&quot;center&quot;>
<CFSELECT name=&quot;cboEventType&quot; required=&quot;Yes&quot;>
<option value=&quot;1&quot;>Business
<option value=&quot;0&quot;>Personal
</cfselect>
</td>

<td width=&quot;100&quot; align=&quot;center&quot;>

<CFOBJECT action=&quot;CREATE&quot; class=&quot;MSComCtl2.DTPicker.2&quot; name=&quot;dtp&quot; type=&quot;COM&quot;>

</td>

<td align=&quot;center&quot;>
New Expense
</td>

<td align=&quot;center&quot;>
<input type=&quot;Submit&quot; value=&quot;Send&quot; name=&quot;cmdSendNewExpense&quot;>
<input type=&quot;Submit&quot; value=&quot;Cancel&quot; name=&quot;cmdCancelNewExpense&quot;>
</td>

</cfform>


Thanks again!
 
I think I see the problem. Just putting the code to the calender control won't make it show up in your web page like it does in VB or C++. The <cfobject> tag gives you a way to invoke the methods of the control. I'm not familiar with the specific control but the only way you'll be able to make it show up is if the control has a function you can call that generates html to pass back to the browser. If it does, you would need to call the appropriate function, retrieve the results, and then use <cfoutput> to display the html code it generated.

GJ
 
Well, I guess I either have to find out which function to call, or find another calender control similar to this one. I am very familiar with this control in VB and I thought ColdFusion was 100% compatible with all MS COM objects. Maybe I'll buy a book that explains COM objects a little better. Any suggestions on books?

Thanks...
 
I like the O'Reilly series at OReilly.com although I don't know if they have a book on that particular topic.

GJ
 
Cossiboon, I am not sure it is really necessary for the COM object to be able to generate some HTML. However you do it, the COM object won't instantiate unless you connect to it. I think you might wanna try the following code, although I am not familiar with the control you're talking about:

<!--- Try to connect to the Word application object --->
<CFTRY>
<!--- If it exists, connect to it --->
<CFOBJECT
ACTION=&quot;CONNECT&quot;
CLASS=&quot;MSComCtl2.DTPicker.2&quot;
NAME=&quot;objCalendar&quot;
TYPE=&quot;COM&quot;>
<CFCATCH>
<!--- The object doesn't exist, so create it --->
<CFOBJECT
ACTION=&quot;CREATE&quot;
CLASS=&quot;MSComCtl2.DTPicker.2&quot;
NAME=&quot;objCalendar&quot;
TYPE=&quot;COM&quot;>
</CFCATCH>
</CFTRY>

Then, within a block of CFSCRIPT, you should be able to use some of the methods and properties of the object. Fictious example:

<CFSCRIPT>
objCalendar.Visible = True
objMonths = objCalendar.Months
</CFSCRIPT>

Let me know if it worked, good luck :)



<webguru>iqof188</webguru>
 
Nah, it didn't. This is the error I received:

Just in time compilation error

Invalid parser construct found on line 23 at position 4. ColdFusion was looking at the following text:

objMonths
Invalid expression format. The usual cause is an error in the expression structure.
The last successfully parsed CFML construct was a CFSCRIPT tag occupying document position (21:1) to (21:10).


What do you think?
 
Oops, missed a part in the CFSCRIPT bit. It should be:

<CFSCRIPT>
objCalendar.Visible = True;
objMonths = objCalendar.Months;
</CFSCRIPT>

By the way, don't take the above code literally, I don't know what the properties and methods are of your component, but I just posted the code as an example on how to work with COM objects in CF. Good luck! :)



<webguru>iqof188</webguru>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top