Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:21:03+00:00 2026-06-02T03:21:03+00:00

Far out, this old vb6 app is killing me. How did I ever develop

  • 0

Far out, this old vb6 app is killing me. How did I ever develop with this stuff before .NET.

I’m trying to creat a vb6 Class with a Property member being an Array of either UDT or another Class.

e.g.

I have a Class called Monitor which exposes a few properties:

  • Resolution
  • Rotation
  • Name
  • Width
  • Height

In my main program module I have a class called SystemConfig which has a property called MonitorConfig, but previously it only facilitated one item. Because we now operate in a world of multiple monitors, I need this property to support more than one item.

Unfortunately vb6 doesn’t give me List(Of T) so I need the next best thing. My first thought is to use an Array.

Here’s my attempt:

Private m_MonitorConfig() As Monitor

Public Property Get MonitorConfig() As Monitor()
    MonitorConfig = m_MonitorConfig
End Property
Public Property Let MonitorConfig(val() As Monitor)
    m_MonitorConfig = val
End Property

How do I get the property to recognise an array value in and out of the MonitorConfig property?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:21:05+00:00Added an answer on June 2, 2026 at 3:21 am

    Your code is ok but it’s not very performant. If you need read-only access to monitors but don’t want to implement a full-blown collection, then a simple accessor property and count property would be enough.

    Something like this:

    Option Explicit
    
    Private Declare Function EmptyMonitorsArray Lib "oleaut32" Alias "SafeArrayCreateVector" (Optional ByVal vt As VbVarType = vbObject, Optional ByVal lLow As Long = 0, Optional ByVal lCount As Long = 0) As Monitor()
    
    Private m_MonitorConfig() As Monitor
    
    Property Get MonitorConfig(ByVal Index As Long) As Monitor
        Set MonitorConfig = m_MonitorConfig(Index)
    End Property
    
    Property Get MonitorConfigs() As Long
        MonitorConfigs = UBound(m_MonitorConfig) + 1
    End Property
    
    Private Sub Class_Initialize()
        m_MonitorConfig = EmptyMonitorsArray
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying for a while to work this out with no success so far
Maybe it's easy, but I couldn't really figure this out right so far... I
Thanks to everyone out there helping newbies like me. So far I have this:
While this stems from the age-old debate between Java and .NET, I'm interested in
I'm migrating an old vb desktop app to an ASP.NET web application version. The
I'm trying to use the mini-profiler with old-style EF code - database-first. So far:
This is far to advanced for me to figure out. Here is an example
As far as I know there is no way to do this, but I
As far as I know, ASP.NET MVC leverages a lot of the features of
So far I've migrated two ASP.NET MVC 1 solutions to MVC 2 and therefore

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.