Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


CommonDialog Control in VB5

Posted on 1999-06-25
Medium Priority
Last Modified: 2008-02-01
Im converting a VB4 program into VB5 but the commonDialog Control (using file open) in my program is no longer supported in VB5. What code should I use in replace of it?

CommonDialog1.Flags = cdlOFNFileMustExist& cdlOFNPathMustExist &cdOFNLongNames & cdlOFNHideReadOnly

CommonDialog1.InitDir = "C:\Program Files"
   If CommonDialog1.filename <> "" Then
      Me.Text1(Index).Text = CommonDialog1.filename
   end if
Question by:LeeGar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 12

Expert Comment

ID: 1519869
When setting the flags use 'Or' instead of '&'. Other than that it's fine.

CommonDialog1.Flags = cdlOFNFileMustExist Or _
cdlOFNPathMustExist Or cdlOFNLongNames Or cdlOFNHideReadOnly


Author Comment

ID: 1519870
I guess it isn't the code, but I had to delete the old commonDialog object off my form(it was registering it as a commonDialogPictureBox!) and go to Project/Components and select CommonDialog controls 6 and reinsert the control back on the form. But for some reason when I try to work on the program on another computer that didn't have VB4 on it, It tells me I dont have licence approval for some ocx controls ????who knows!

Accepted Solution

RanOsb earned 200 total points
ID: 1519871
To fix this remove the control from your projects form and then find out where the ms commoncontrol 5.0 is pointing to. That file should be in the win system dir as mscomdlg32.ocx.
if not, move the file its pointing to (so it clears itself) & then browse to the ocx file mentioned to re-establish the commonDialog control on your form. Then you can add it again to your form & save!

Author Comment

ID: 1519872
That works, your right on VB doesn't let you change registered controls, only if it can't find it anymore will it clear!!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question