Results 1 to 13 of 13

Thread: !! Working with Control Arrays !!

  1. #1

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    !! Working with Control Arrays !!

    I am working with a Form and a Control Array, found inside the Form. But I don't know what kind of control the end-user is going to load in the FileListBox control. But it has the OCX file extension, with it...

    Can someone, please help me???
    !! Thanks in advance !!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: !! Working with Control Arrays !!

    A control array is an array of all the same kind of control.

    What is it that you want the user to be able to do? Add completely new controls? Add new members to an existing control array?

  3. #3
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: !! Working with Control Arrays !!

    ThEiMp

    If your desire is Marty's second scenario (add new members to an
    existing control array), then you can use the Load statement

    EDIT:
    Here is a possible code snippet:
    Code:
    For ii = nn to zz
        Load MyControl(ii)
        With MyControl(ii)
            .Top = v1
            .Left = v2
            .Visible = True
        End With
    Next ii
    ... natch, change as required.

    Things to keep in mind:
    • a variable to track how many controls you've added so far
    • use the Unload statement to remove unwanted ones

    Spoo
    Last edited by Spoo; Jul 21st, 2011 at 10:01 PM.

  4. #4

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: !! Working with Control Arrays !!

    If it isn't obvious to the other members:
    Actually I am trying to get a Control Array of unknown controls, to the program to be added in a Control Array. Every example, I have seen and done works with the program's knowledge of the control, at design-time. Which is basically what I don't want to happen...

    -- Not Sure why there is any error checking in that. It must work fine, without it...
    Code:
    Sub LoadCntlArray(ByRef cntlArray As Object)
    On Error Resume Next
    
    Dim cntl As Control
    
    For Each cntl In cntlArray
        Me.Controls.Add Blah Blah
    Next
    
    End Sub
    !! Thanks in advance !!
    Last edited by ThEiMp; Jul 22nd, 2011 at 04:14 AM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: !! Working with Control Arrays !!

    maybe you need to use a known user control for an array, that each can contain an instance of the unkown control, loaded at runtime
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: !! Working with Control Arrays !!

    Quote Originally Posted by MartinLiss View Post
    ...What is it that you want the user to be able to do? Add completely new controls? Add new members to an existing control array?
    You never did answer my question.

  7. #7

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: !! Working with Control Arrays !!

    -- So sorry, about not answering questions. I had to hurry out of the office...

    1. I am trying to get the end-user to add anykind of ActiveX control, that has the extension of ocx, into my IDE's Design-Time mode. But not sure how to do that. I am working with the source code, that I had posted, before this post. Also: The Controls must be contained however, inside the FileListBox control, and have their real process names, and not Filename.ocx. But instead they must be something like: SSTab ActiveX Control, or something like that, for all of them in the FileListBox...

    2. Yes, I do wish to add new controls to the IDE, that I have written...

    3. I cannot remember what members, are in VB6... (Might be getting myself confused, with Director.)
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: !! Working with Control Arrays !!

    Quote Originally Posted by ThEiMp View Post
    ...I am trying to get the end-user to add anykind of ActiveX control, that has the extension of ocx, into my IDE's Design-Time mode….
    Form your original post I had NO idea that that was what you were trying to do. A full description of what you are trying to do would have saved me some time since I would have realized that I have no idea how to help you and I wouldn't have replied.

  9. #9

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: !! Working with Control Arrays !!

    --So sorry, to have wasted your time...
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: !! Working with Control Arrays !!

    No problem. I was just trying to point out that while you of course know what you are working on, we don't, so when you create a new thread you always need to tell us.

  11. #11

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: !! Working with Control Arrays !!

    !! Wait a minute !!

    Problem: How about we get my IDE, to read the ocx Control, and then extract the name of the Control, eg: CommandButton. And work from there???

    Component Insert, MenuItem, using my CustomDialog Control:
    Code:
    Public Sub Comp_Insert_Click()
    On Error Resume Next
    
    Dim cntl As Control
    
    With CustomDialog1
        .FilterEnabled = True
        .Filter = "ocx"
    End With
    
    frmMain1.CustomDialog1.ShowOpen
    
    frmMain1.List1.AddItem "Unbound ActiveX Control: " & cntl
    frmDesign1.Controls.Add cntl
    
    End Sub
    Last edited by ThEiMp; Jul 22nd, 2011 at 12:32 PM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: !! Working with Control Arrays !!

    Quote Originally Posted by ThEiMp View Post
    -- So sorry, about not answering questions. I had to hurry out of the office...

    1. ... The Controls must be contained however, inside the FileListBox control, and have their real process names, and not Filename.ocx. But instead they must be something like: SSTab ActiveX Control, or something like that, for all of them in the FileListBox...
    The HelpString property of a typelib object is what you are looking for I believe. It is rather simple to return that string...
    1. Add reference of "TypeLib Information" to your project.
    2. Simply add path/filename in sample code below
    Code:
    Dim oLibInfo As TypeLibInfo, ctlLongName As String
    Set oLibInfo = TLI.TLIApplication.TypeLibInfoFromFile(path/filename)
    ctlLongName = oLibInfo.HelpString
    Note that a file list box cannot be used here. You cannot modify its contents; you may want to use a listview so you can keep the filename and helpstring plus any other information together. Just an idea.

    Edited: And regarding arrays; don't think that will happen. You'll need a base object, indexed, to append to any array. However, nothing saying you can't create a collection of objects, or classes, to act like a control array
    Last edited by LaVolpe; Jul 22nd, 2011 at 01:26 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: !! Working with Control Arrays !!

    Okay So Far: I have been able to add the ListView control into the Project, and have added the source code, that last poster, LaVolpe has given to me. I have pointed the source destination of the source code to point to the c:\windows\system32 folder. If that is correct or not, please tell me if so???

    No I need, more help in the way of that what LaVolpe has given me, or could you please help me, some more???
    !! Thanks in advance !!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

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