Results 1 to 17 of 17

Thread: How to change a VB6 Control Type (Designer view) to another type.

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2021
    Posts
    5

    Question How to change a VB6 Control Type (Designer view) to another type.

    Hi!

    I'm new here and w/ VB

    Today I am working on a legacy Annotation application used by
    our engineers throughout my company.

    I have successfully installed VB6 and all pre-reqs. I have registered all of my required DLLs. I am referencing the VB6 control library version 6.0 SP6 (MSCOMCTL.OCX). App doesn't run or compile on the 32-Bit Machine due to "Memory issues" (which I don't believe as the problem after research but.. keep reading)

    This (MSCOMCTL) is the ActiveX control that holds the TreeView control yes?
    When loading the application in VB6 in a Windows 32-bit machine, I was getting obnoxious and confusing "Out Of Memory" errors on a few large/major forms.

    Name:  Ykgvgcr.png
Views: 313
Size:  8.9 KB

    I tried just about every option google/the forums offered.
    Slowly removing the references until noticing the "out of memory" error goes away.. didn't help. I moved all of the code (6000 lines are about 8 methods/funcs/routines/whatever) into one mod file.
    This didn't help.


    Here's my issue:



    When I load the solution/project on a 32-Bit machine, I get "Out of Memory" errors that could be many things.

    When I load this project on a 64-bit Dev Win 10 machine, I get "errors occurred during load" BUT, the darn thing loaded my .frx/designer views

    I checkout out my GIT Repo with "Windows style line endings" and reloaded to resolve these errors by the way ^. The old editor seemingly can't handle UNIX endings.


    Now - the only problem I am struggling to solve -

    Name:  OW32yHQ.jpg
Views: 334
Size:  53.7 KB

    The issue wasn't occuring on my 32-Bit Dev machine, the tvw2 object is properly/correctly a TreeView.

    Name:  eqO8SvD.jpg
Views: 375
Size:  24.8 KB

    When loading the project this morning, the SP6 control was not referenced into the VBP.

    The VBP would need this for a TreeView I believe.
    I've seen the following syntax examples:

    Begin VB.TreeView tvw2
    .Caption = "String Val"
    .Width = 1200
    .Height = 4000
    End Begin

    But I can't seem to find an easy way to change the actual type of the control within the .frx/VB6 designer.

    In C#.Net WinForms, I'd just change the designer's code/object type. We're not in Kansas anymore are we..

    Best course of action here?
    I am curious how/why VB thinks it's a picture box;
    What if I first edit the .vbp from a fresh GIT Clone copy, and add (manually) a reference to both MSCOMTL2.OCX and MSCOMCTL.OCX?
    I'll try that next.

    Thank you!!

  2. #2
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.2#0; MSCOMCTL.OCX

    Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX

    some times,This is the case if the version is not correct
    Different computers may use different MSCOMTL2, treeview object control files, even if they are not the same type, I also find it strange
    Are MSCOMCTL.OCX and COMCTL32.OCX the same thing? Old and new version?

    (VB6) Component Documenter-VBForums
    https://www.vbforums.com/showthread....ent-Documenter

    EduardoVB/ComponentDocumenter: For documenting ActiveX components
    https://github.com/EduardoVB/ComponentDocumenter
    This is a tool to help document ActiveX components---
    ------------------
    When I downloaded the above VB project test, I found that it failed to run and failed to load the form. The treeview control becomes a picturebox control.
    I directly opened the *.vbp project file with Notepad, modified the reference of the Treeview OCX, and reopened the project, everything was normal.
    You also need to delete the control, re-add it to the specified location, and modify it to the same name. If the control also sets the header, background color and other information, you also need to manually reset it (it is best to use code directly)
    ======================
    C:\Program Files (x86)\Microsoft Visual Basic 6.0\Controls\COMCTL32.OCX (version 1.3?)
    Microsoft Windows Common Controls 5.0 (SP2)
    When I add the component OCX in VB6, it prompts:
    The license information for this part was not found. In the design environment, there is no suitable license to use this feature.
    The control cannot be added.
    ======================
    Microsoft Windows Common Controls 6.0 (SP6)
    C:\Windows\SysWOW64\MSCOMCTL.OCX (version 2.2?)
    Last edited by xiaoyao; May 6th, 2021 at 09:17 PM.

  3. #3
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    'C:\Program Files (x86)\Microsoft Visual Basic 6.0\Controls\COMCTL32.OCX
    'Microsoft Windows Common Controls 5.0 (SP2)

    Need to download VB6.0 control license error solving patch, which supports
    Windows Common Controls 5.0 (SP2) COMCTL32.OCX 6.00.8022 L,P,E
    Windows Common Controls-2 5.0 (SP2) COMCT232.OCX 6.00.8022 L,P,E
    6.00.8105 (2004-3-9) is installed on my computer

    The actual problem is that you have not obtained a full license. In fact, it will be stored in the registry.

  4. #4
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    It seems that the download resource of VB6cli.exe is not available now. I searched everywhere and found the only download resource: https://support.microsoft.com/EN-US/kb/194751, but when I try it, I have to download it. Its display cannot be downloaded because its release date is October 26, 1998. It is indeed old and not in the scope of support. We apologize for the inconvenience caused to you.

    By the way, VB6Cli.exe is a practical tool designed to solve the design-time permission problem of ActiveX controls included with Microsoft Visual Basic 6.0. Since it is provided with Visual Basic 6.0, VB6Cli.exe should be obtained after Visual Basic 6.0 is successfully installed.

  5. #5
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    To summarize, open the VB6 project file *.prj with Notepad, and replace the old version of the control reference with the new one
    C:\Program Files (x86)\Microsoft Visual Basic 6.0\Controls\COMCTL32.OCX
    Microsoft Windows Common Controls 5.0 (SP2)

    Replace with new:
    Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.2#0; MSCOMCTL.OCX
    Microsoft Windows Common Controls 6.0 (SP6)

  6. #6
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Regarding VB6CLI.exe, the Wayback machine has it archived.

    Code:
    https://web.archive.org/web/20120504095048/http://download.microsoft.com/download/vb60ent/Sample30/1/W9XNT4/EN-US/VB6CLI.EXE

  7. #7
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    If you still want to use the old version of COMCTL32.OCX, please copy COMCTL32.OCX to the specified system directory C:\Windows\SysWOW64, use the registration DLL, and then add a license for a registry key to succeed.

  8. #8
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Without installing the VB6 development environment, when I try to dynamically load the third-party control OCX in the compiled EXE, I also need to add a license.
    Maybe the VB6 IDE will automatically add the license to the EXE when editing components after adding components

  9. #9
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by DontDoThat21 View Post

    Best course of action here?
    I am curious how/why VB thinks it's a picture box;
    What if I first edit the .vbp from a fresh GIT Clone copy, and add (manually) a reference to both MSCOMTL2.OCX and MSCOMCTL.OCX?
    I'll try that next.

    Thank you!!
    VB already replaced the Treeview control with a Picturebox, it uses a Picturebox as a generic control to replace controls that doesn't know, after a "could not load" message.

    So you'll have to use the original project because the current one is already damaged.

    Why? Because for whatever reason some component, the common controls in this case, was in a greater version than the one registered in the machine that you are loading the project.
    It does not mean that the control that you have now is older, it is a mishandled versioning system from MS.

    For example (and probably), in the original *.vbp file is:

    Code:
    Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.4#0; COMCTL32.OCX
    But your current Threeview (and Common Controls) version is 1.3, so change it:

    Code:
    Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX
    Edit the files with a text editor, like Notepad.
    If you put a lower value it does not cause problem to load, so you could put 1.0

    This is on the vbp file, but it is also on the form, the *.frm file(s)

    So, open the form file and do the same change.


    About Unix line feeds.
    If you uploaded the project to GitHub and downloaded it from there, all CR/LF are changed to LF. You need to declare in the .gitattributes for GitHub not to change them.
    VB does not open right the files without CR/LF as line breaks.

  10. #10
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by Eduardo- View Post
    About Unix line feeds.
    If you uploaded the project to GitHub and downloaded it from there, all CR/LF are changed to LF. You need to declare in the .gitattributes for GitHub not to change them.
    VB does not open right the files without CR/LF as line breaks.
    we need a vb6 code tool for change unix github project file

  11. #11
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by xiaoyao View Post
    we need a vb6 code tool for change unix github project file
    I guess if you open the files, replace vbLF with vbCrLf and then to ensure that you didn't replace them wrongly by replacing again vbCr & vbCrLf with vbCrLf and write the resulting file, the issue should be fixed.

    Anyway, to prevent that to happen, I attach the .gitattributes file I'm using, that I've copied from one of wqweto's Planet-Source-Code GitHub repositories.

    With that file present, GitHub won't change the line feeds to Unix format.
    Attached Files Attached Files

  12. #12
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by Eduardo- View Post
    I guess if you open the files, replace vbLF with vbCrLf and then to ensure that you didn't replace them wrongly by replacing again vbCr & vbCrLf with vbCrLf and write the resulting file, the issue should be fixed.

    Anyway, to prevent that to happen, I attach the .gitattributes file I'm using, that I've copied from one of wqweto's Planet-Source-Code GitHub repositories.

    With that file present, GitHub won't change the line feeds to Unix format.
    how to use it?

  13. #13
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by xiaoyao View Post
    how to use it?
    If you upload a project to GitHub using GitHub Desktop program, copy this file on the root of the project (or course, unzipped).

  14. #14

    Thread Starter
    New Member
    Join Date
    May 2021
    Posts
    5

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Lol, when I was being onboarded as a Freshie two years ago, I remember doing initial-commit (yes, THAT initial commit lmfao) in 2018 with my manager.

    The 1990-2018 Source code the Senior dev. worked on was never in source control hahahaa. (*gulp*) As a freshie, I had no idea the initial setup when installing GIT on Windows was so impactful.
    GIT: "When checking our files locally, would you like to use WIN/LINUX/MAC Style line endings." Which broke all of the VB6 code lol.

  15. #15

    Thread Starter
    New Member
    Join Date
    May 2021
    Posts
    5

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Hi Everyone!

    Thanks for the tips. I took the approach of slowly removing the references from my VBP (Even though Visual Basic was not giving me any tell-tale signs to do this/prompts.) and it completely resolved my issues.

    The above picture box issue is evidently an issue with VB6 from what I can tell; When I tried to load the .frm and the .vbp/IDE can't understand what my "tvw2" object is (re-add your references!) it actually CHANGED the 'Designer' code.
    The 'Designer' code was what told me I had a major issue:

    Begin VB.ObjectTypeControl Bla
    .Bla = 1
    .Bla2 = 2
    End Begin

    The tvw2 was a TreeView before the issue occurred/said it couldn't load, and opening the Form changed the designer's source. It changed to objects to PictureBoxes.
    Resolved by adding MSCOMCTL2.ocx back and re-registering.

  16. #16
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by Eduardo- View Post
    If you upload a project to GitHub using GitHub Desktop program, copy this file on the root of the project (or course, unzipped).
    I have always used the online download method and rarely use the client. I wonder if there is an interface code for downloading and uploading GITHUB of VB6?

  17. #17
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: How to change a VB6 Control Type (Designer view) to another type.

    Quote Originally Posted by DontDoThat21 View Post
    Hi Everyone!

    Thanks for the tips. I took the approach of slowly removing the references from my VBP (Even though Visual Basic was not giving me any tell-tale signs to do this/prompts.) and it completely resolved my issues.

    The above picture box issue is evidently an issue with VB6 from what I can tell; When I tried to load the .frm and the .vbp/IDE can't understand what my "tvw2" object is (re-add your references!) it actually CHANGED the 'Designer' code.
    The 'Designer' code was what told me I had a major issue:

    Begin VB.ObjectTypeControl Bla
    .Bla = 1
    .Bla2 = 2
    End Begin

    The tvw2 was a TreeView before the issue occurred/said it couldn't load, and opening the Form changed the designer's source. It changed to objects to PictureBoxes.
    Resolved by adding MSCOMCTL2.ocx back and re-registering.
    In fact, your project uses the old version of the control, you only need to add a line of the registry to solve it. If you don't do this, just change a control, which is actually a new version, so the code basically does not need to be changed.

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