|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Common Dialog ConfusionHave an old VB6 project that uses ' as CommonDialog'
I copied files over to a new project. It comiples fine but does not run. The call to the sub using the 'as CommonDialog' fails and says Type Mismatch So I changed it to as Object, it works, but now no intellisense. Also cannot set .DialogTitle (may not be remembering that one correctly). If I go to the sub with as CommonDialog in place, then the referneces are to some other sub e.g. sub x (cdl as CommonDialog) with cdl .ShowAcquireImage ' this is what intellsense allows, but not CommonDialog stuff end with What did I do wrong? I checked and only have one CommonDialog component and it is a VB6 component. OK, so in this large project I am getting rid of the CommonDialog component
in favor of the API methods. So ... when I try to remove the component, it says it is in use; meaning that the object is sitting on some form some place. But where? If a predecessor hid it under something, it is not easy to spot. (1) Is there a tool to scan to find where the multiple components are located and even possible remove them? I do not see anything in the IDE to do this, but them I am probably missing something. Does MZTools do this? (2) I do not see a way to pass the API a title. Rather than just Color, I would like to title it more appropriately e.g. "Thingy Color". Can do? Show quoteHide quote "Bee" wrote: > Have an old VB6 project that uses ' as CommonDialog' > I copied files over to a new project. > It comiples fine but does not run. > The call to the sub using the 'as CommonDialog' fails and says Type Mismatch > So I changed it to as Object, it works, but now no intellisense. > Also cannot set .DialogTitle (may not be remembering that one correctly). > > If I go to the sub with as CommonDialog in place, then the referneces are to > some other sub e.g. > > sub x (cdl as CommonDialog) > with cdl > .ShowAcquireImage ' this is what intellsense allows, but not > CommonDialog stuff > end with > What did I do wrong? > I checked and only have one CommonDialog component and it is a VB6 component. >
Show quote
Hide quote
"Bee" <B**@discussions.microsoft.com> wrote in message None exist that I know of. Just search .frm files having "CommonDialog" in news:C57EC6BF-4FCC-4318-9BBE-6A47FEC14D8E@microsoft.com... > OK, so in this large project I am getting rid of the CommonDialog > component > in favor of the API methods. > So ... when I try to remove the component, it says it is in use; meaning > that the object is sitting on some form some place. > But where? > If a predecessor hid it under something, it is not easy to spot. > > (1) Is there a tool to scan to find where the multiple components are > located and even possible remove them? > I do not see anything in the IDE to do this, but them I am probably > missing > something. > Does MZTools do this? them. If worse comes to worse, open each .frm file in Notepad. I'd make backups of them before editing them in Notepad, though. Very easy to screw something up which prevents the form (or even the whole project) from loading. > So you mean you're calling the ChooseColor API function now instead of using > (2) I do not see a way to pass the API a title. Rather than just Color, I > would like to title it more appropriately e.g. "Thingy Color". Can do? the Common Dialog control? You weren't really too clear on some points. Might have to use the SetWindowText API function, which means you'd need the dialog box's window handle, which means you may have to handle the WM_INITDIALOG message. Or it might even be more involved than that. -- Mike Here's what you need to customize the color dialogue from
Randy Birch's site: http://vbnet.mvps.org/code/hooks/choosecolorcustomize.htm He also shows, on that page, how to use the callback function to make the custom colors boxes workable, which is a nice touch. If you set that up and save the custom colors in the program settings somewhere then you can allow people to save favorite colors between uses of the program. I'm not sure whether Randy's sample has all options, but you can customize *at least* the following: The window text. The text over the custom colors selection. The text on the button that normally says, "Add to custom colors". If you have Visual Studio you can see how it works and get the IDs of the window elements by looking at the file color.dlg in the folder Microsoft Visual Studio\VC98\Include\. As for the component, you can look for it in the Properties dropdown list for each form, rather than picking over the form itself. If all else fails you could remove the reference from the ..vbp file before starting. Then VB will find the control for you. :) Show quoteHide quote > OK, so in this large project I am getting rid of the CommonDialog component > in favor of the API methods. > So ... when I try to remove the component, it says it is in use; meaning > that the object is sitting on some form some place. > But where? > If a predecessor hid it under something, it is not easy to spot. > > (1) Is there a tool to scan to find where the multiple components are > located and even possible remove them? > I do not see anything in the IDE to do this, but them I am probably missing > something. > Does MZTools do this? > > (2) I do not see a way to pass the API a title. Rather than just Color, I > would like to title it more appropriately e.g. "Thingy Color". Can do? > > "Bee" wrote: > > > Have an old VB6 project that uses ' as CommonDialog' > > I copied files over to a new project. > > It comiples fine but does not run. > > The call to the sub using the 'as CommonDialog' fails and says Type Mismatch > > So I changed it to as Object, it works, but now no intellisense. > > Also cannot set .DialogTitle (may not be remembering that one correctly). > > > > If I go to the sub with as CommonDialog in place, then the referneces are to > > some other sub e.g. > > > > sub x (cdl as CommonDialog) > > with cdl > > .ShowAcquireImage ' this is what intellsense allows, but not > > CommonDialog stuff > > end with > > What did I do wrong? > > I checked and only have one CommonDialog component and it is a VB6 component. > > That would turn the CDL into pictureboxes no doubt.
The log files generated on error would tell me. the forms to look at closely. Is that correct? Show quoteHide quote "mayayana" wrote: > Here's what you need to customize the color dialogue from > Randy Birch's site: > > http://vbnet.mvps.org/code/hooks/choosecolorcustomize.htm > > He also shows, on that page, how to use the callback function > to make the custom colors boxes workable, which is a nice > touch. If you set that up and save the custom colors in > the program settings somewhere then you can allow people > to save favorite colors between uses of the program. > > I'm not sure whether Randy's sample has all options, but > you can customize *at least* the following: > > The window text. > The text over the custom colors selection. > The text on the button that normally says, "Add to custom colors". > > If you have Visual Studio you can see how it works > and get the IDs of the window elements by looking at > the file color.dlg in the folder Microsoft Visual Studio\VC98\Include\. > > As for the component, you can look for it in the Properties > dropdown list for each form, rather than picking over the > form itself. > If all else fails you could remove the reference from the > ..vbp file before starting. Then VB will find the control for you. :) > > > > > OK, so in this large project I am getting rid of the CommonDialog > component > > in favor of the API methods. > > So ... when I try to remove the component, it says it is in use; meaning > > that the object is sitting on some form some place. > > But where? > > If a predecessor hid it under something, it is not easy to spot. > > > > (1) Is there a tool to scan to find where the multiple components are > > located and even possible remove them? > > I do not see anything in the IDE to do this, but them I am probably > missing > > something. > > Does MZTools do this? > > > > (2) I do not see a way to pass the API a title. Rather than just Color, I > > would like to title it more appropriately e.g. "Thingy Color". Can do? > > > > "Bee" wrote: > > > > > Have an old VB6 project that uses ' as CommonDialog' > > > I copied files over to a new project. > > > It comiples fine but does not run. > > > The call to the sub using the 'as CommonDialog' fails and says Type > Mismatch > > > So I changed it to as Object, it works, but now no intellisense. > > > Also cannot set .DialogTitle (may not be remembering that one > correctly). > > > > > > If I go to the sub with as CommonDialog in place, then the referneces > are to > > > some other sub e.g. > > > > > > sub x (cdl as CommonDialog) > > > with cdl > > > .ShowAcquireImage ' this is what intellsense allows, but not > > > CommonDialog stuff > > > end with > > > What did I do wrong? > > > I checked and only have one CommonDialog component and it is a VB6 > component. > > > > > > > That would turn the CDL into pictureboxes no doubt. That's weird. You're right! I can't imagine how> The log files generated on error would tell me. the forms to look at closely. > Is that correct? > someone might have thought it was a good idea to turn a missing control into a picture box. But that's what it did when I tried it. I removed this line from the .vbp file: Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX While it created a picture box, it did write a log file, as you suspected: Class MSComDlg.CommonDialog of control CommonDialog1 was not a loaded control class. So that method will work if you just have too many forms to do it the other way. But of course you'll then still need to hunt down the picture boxes named CommonDialogue1. :) > That's weird. You're right! I can't imagine how So what would you suggest VB do with missing controls if you don't think a > someone might have thought it was a good idea > to turn a missing control into a picture box. But > that's what it did when I tried it. picture box is a good idea. Since VB doesn't have any idea what properties the missing control should have, at least displaying a picture box gives you a visual representation of where it should be on the form. > > That's weird. You're right! I can't imagine how It's not a missing control. With the reference gone> > someone might have thought it was a good idea > > to turn a missing control into a picture box. But > > that's what it did when I tried it. > > So what would you suggest VB do with missing controls if you don't think a > picture box is a good idea. Since VB doesn't have any idea what properties > the missing control should have, at least displaying a picture box gives you > a visual representation of where it should be on the form. > it's an invalid control. If VB finds an invalid control it should tell me, remove it, and log the error. If I send my shopping list for home delivery and include an order for 1 lb. of "sidarky", I expect the store to point out the error. I don't expect them to just decide for themselves, willy nilly, that they'll send me 1 lb. of cream cheese. :) > It's not a missing control. With the reference gone If the reference is not there, then according to VB it is missing from the > it's an invalid control. project (even though the file may physically be on your system it is still missing in the project). > If VB finds an invalid control it should tell me, When you try to access the form VB does inform you that there were errors > remove it, and log the error. If I send my shopping > list for home delivery and include an order for 1 lb. of > "sidarky", I expect the store to point out the error. > I don't expect them to just decide for themselves, > willy nilly, that they'll send me 1 lb. of cream cheese. :) during the load and tells you the name of the log file which contains more details. If you have a non visual control such as the Common Dialog control, then I guess it would be ok to just remove it, but for visual controls I would prefer to have the picture box in place of where the missing control was so I knew where on the form it was originally (and not have to guess when adding the control back to the form). I'm not sure why you think it is such a bad idea to put a picture box where the original control was.
Rubberband Line with ScrollBar
Active X and Vista Why there is a limit of 65,536 bytes when writing to file? Value > Long Data Type ShellExecute to html file in VB.net VB 6 IDE on 64-bit Windows ACCURACY of making templates on a printer Detecting Control Array VB6 Error 440 or 3021 VB .Net General Help |
|||||||||||||||||||||||