|
-
Oct 13th, 2011, 03:26 PM
#1
Thread Starter
New Member
[RESOLVED] CommonDialog1 "object not found"
I'm currently editing someone else's code, paring a large program down to some small features that I want to be more portable.
In the process, a fairly mundane reference to CommonDialog (the "preferred" Open-File dialog reference) stopped working. It now produces an "object not found" error on the first reference it encounters. The code looks like:
Code:
'open dialog box to ask for control line report filename (text file)
CommonDialog1.DialogTitle = "Control Line Report Filename" 'dialog box title
CommonDialog1.Filter = "All Files (*.*)|*.*|CommandFile (*.txt) |*.txt|" 'filename extensions
CommonDialog1.FilterIndex = 2 'filename filter to txt (default filename)
CommonDialog1.filename = "" 'clear dialog textbox
CommonDialog1.CancelError = True 'allow cancel button function
CommonDialog1.ShowOpen 'show the dialog box
filename = CommonDialog1.filename 'textbox filname for output
I've searched the web. It looks like comdlg32.ocx must be present... it (still) is. The previous code runs fine on my system, and has no explicit references to comdlg32.ocx, nor to CommonDialog1, except as noted in the code above.
I've basically given up and started all over from scratch with the working legacy code, but at any moment whatever I broke before might break again...
Any clues?
-
Oct 13th, 2011, 05:55 PM
#2
Junior Member
Re: CommonDialog1 "object not found"
I can't help with the problem itself, but you can free your programs from runtimes using the API. In this case I'd recommend "GetOpenFileName".
Last edited by Pascal.Scholtes; Oct 13th, 2011 at 05:57 PM.
Reason: Link added
Look busy. Jesus is coming.
-
Oct 13th, 2011, 06:29 PM
#3
Thread Starter
New Member
Re: CommonDialog1 "object not found"
Thanks. So noted. But it does entail changing even more legacy code... So I'll do it if the problem recurs, I suppose.
-
Oct 13th, 2011, 06:44 PM
#4
Re: CommonDialog1 "object not found"
To begin with, you can't use an object unless it exists. So you need to have a CommonDialog control with that name someplace, such as on the Form you are working with there.
"Object not found" sounds like a compile-time error (which can appear when trying to run within the IDE of course). The project should fail to compile when you do a Make on it.
-
Oct 13th, 2011, 07:10 PM
#5
Thread Starter
New Member
Re: CommonDialog1 "object not found"
Ah! One of those hidden controls, that's really just a placeholder for the code it carries! Gotcha!!!
-
Oct 13th, 2011, 07:56 PM
#6
Thread Starter
New Member
Re: CommonDialog1 "object not found"
dilettante, a winner is you. That worked. And it explains why the code broke at some random point in my cleanup process - I caught the control in a selection sweep of other controls I was deleting.
-
Oct 13th, 2011, 08:45 PM
#7
Re: CommonDialog1 "object not found"
Glad to hear it. You can mark this resolved by using Thread Tools just above your first post here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|