Results 1 to 31 of 31

Thread: How do I create a TypeLib for UDTs in VB6?

Threaded View

  1. #29
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: How do I create a TypeLib for UDTs in VB6?

    I'm not really sure it needs a conversion program.

    • start a new class and name it the name of the UDT declaration
    • remove the Type...End Type lines from the UDT declaration
    • cut-paste all the items of the type into the new class
    • put the Public keyword before all the items
    • put the "New" keyword in all the places where you'd declared a variable with your UDT
    • and you should be good to go


    I suppose one might be handy. If I were to write it, I'd just have it do it from the clipboard. Copy old UDT into the clipboard, run my little program, paste results into new class module.

    Not sure there's an easy way around inserting the "New" keyword though.

    Regards,
    Elroy

    EDIT1: I suppose one downside I see is where you use Private Type UdtTypeName, and then use that same UdtTypeName in other places with a different set of items. That's horrible programming practice, but it would create a bit more work to convert one or all to classes.

    Also, of course, the "New" keyword isn't used in argument declarations.

    EDIT2: Also, just thinking about it, I suppose it would be a bit less resource intensive if you actually did create Friend Property Get and Friend Property Let procedures for all of them, and then have those Get/Let module level variables in the new class. But my bullet-points above would certainly get it done.
    Last edited by Elroy; Aug 20th, 2016 at 07:56 PM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

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