Results 1 to 15 of 15

Thread: [RESOLVED] reference comdlg32.ocx

  1. #1

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Resolved [RESOLVED] reference comdlg32.ocx

    hi i was messing around bc on the computers at my school when we try to open components (common dialogs and such) vb at once closes but if you reference COMDL32.oxc this allows you to dim a varable as a common dialog control but how would i go about using it when i dim it as such?
    Last edited by dark_shadow; Nov 25th, 2005 at 12:28 PM.

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reference COMDL32.oxc

    What?????

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: reference COMDL32.oxc

    Do you have ComDlg32.ocx on your system? Are you using VB6? Do you have SP6 installed? Don't try to use Office controls, as you cannot distribute them. You app won't work if the user doesn't have Office (with the same version as you do) installed.

  4. #4

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference COMDL32.oxc

    Quote Originally Posted by dglienna
    Do you have ComDlg32.ocx on your system? Are you using VB6? Do you have SP6 installed? Don't try to use Office controls, as you cannot distribute them. You app won't work if the user doesn't have Office (with the same version as you do) installed.
    yes,yes, i'm pretty sure and i didnt use office controls i dont think anyway

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: reference COMDL32.oxc

    Do you have SP6? Can you install? You might need admin privileges to install it

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reference COMDL32.oxc

    All I can say is zip and post your project...

  7. #7

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference comdlg32.ocx

    ok providing you have the comdlg32.ocx in you system32 (which the the place i am at does) you can add it as a reference (project->references->browse ->activex controls ->comdlg32.ocx you can put the following code

    VB Code:
    1. Dim b As CommonDialog
    but i'm not sure how to actually ues it correctly

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reference comdlg32.ocx

    dark_shadow,

    Once you include the reference in your project, you drop it on your form and it will appear as CommonDialog1. At that point you don't have to Dim it. You just use it as such:
    VB Code:
    1. On Error GoTo errHandler
    2.     CommonDialog1.Flags = cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNFileMustExist + cdlOFNLongNames + cdlOFNExplorer
    3.     CommonDialog1.CancelError = True
    4.     CommonDialog1.InitDir = DirName  ' A default folder
    5.     CommonDialog1.Filename = Filename ' A default filename
    6.     CommonDialog1.Filter = "Template Script |*.tpl"
    7.     CommonDialog1.ShowOpen
    8.    
    9.     cboTplFile.Text = CommonDialog1.Filename
    10.     cboTplFile.Tag = 1
    11.     SaveIni = True
    12.     Exit Sub
    13.    
    14. errHandler:
    15.  
    16.     Select Case Err
    17.     Case 32755 '  Dialog Cancelled
    18.        DoEvents
    19.     Case Else
    20.        MsgBox "Unexpected error. Err " & Err & " : " & Error
    21.     End Select

  9. #9

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference comdlg32.ocx

    when i reference it the control does not show up on the components bar so i cant "drop" it on the form

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: reference comdlg32.ocx

    Try out this sample to see if the control shows up.

    http://vbforums.com/attachment.php?attachmentid=40809

  11. #11
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reference comdlg32.ocx

    Did you reference it as a component.

  12. #12

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference comdlg32.ocx

    i went to project->references-> browse-> then in the type of file drop down field i went to activeXcontrols and clicked comdlg32.ocx then hit ok

  13. #13

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference comdlg32.ocx

    Quote Originally Posted by dglienna
    Try out this sample to see if the control shows up.

    http://vbforums.com/attachment.php?attachmentid=40809

    yes the control shows up fine i know how to drop it in when you go to componets but you can also dim as CommonDialog when you reference the comdlg32.ocx and i would like to know how to use when its dimed

  14. #14
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: reference comdlg32.ocx

    Dim Somevar as CommonDialog1

    Set Somevar = New CommonDialog1

  15. #15

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: reference comdlg32.ocx

    alright thanks alot worked great

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width