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 4014312
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:28:54+00:00 2026-05-20T09:28:54+00:00

I am creating a class (Class B) which is used by another class (Class

  • 0

I am creating a class (“Class B”) which is used by another class (“Class A”) which instantiates it in VB.NET 3.5.

I would like Class B to read a value assigned to one of its properties by Class A every time an event happens in Class B.

However, I would like this property value to be dynamically assigned to the property by Class A when the event is fired in Class B.

I was thinking about somehow creating a delegate function in Class A that is linked to the property in Class B so that when the event is fired in Class B it would eventually invoke the delegate in Class A so that it returns a value to Class B.

I’ve been reading around delegates (that’s how I arrived at the idea), but I am stuck on how to code this up – could someone please help with some skeleton code?

Also, I am not sure that this is the best approach for this – are there better solutions?

Thanks for your input.

  • 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-05-20T09:28:54+00:00Added an answer on May 20, 2026 at 9:28 am

    I would probably isolate this from both classes a little. Maybe create a singleton that creates the value from Class A and just call that from Class B.

    So

    Public Class MySingleton
    
       'Singleton related code here
    
       Public Property MyDynamicValue As Integer
    
    End Class
    

    Then in Class A

    Public Sub HandleClassBEvent(ByVal sender As Object, ByVal e As EventArgs) Handles ClassB.MyEvent
       MySingleTonInstance.MyDynamicValue = SetMyDynamicValue()
    End sub
    

    In Class B

       Public ReadOnly Property MyValueFromClassA Integer
          Get
               MySingletonInstance.MyDynamicValue
          End Get
       End Property 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a class that determines which of number of registered WCF client
I'm creating an ORM in PHP, and I've got a class 'ORM' which basically
I'm creating a custom control, part of which is using the Graphics class to
I'm building an ASP.Net website. I have a cart class which stores the items
Let's say I have a Size class which has height and width properties (in
When creating a class library in C++, you can choose between dynamic ( .dll
When creating a class that has internal private methods, usually to reduce code duplication,
I'm creating a class named TetraQueue that inherits System.Collections.Generic.Queue class overriding the Dequeue method,
I just found myself creating a class called InstructionBuilderFactoryMapFactory. That's 4 pattern suffixes on
I'm in the process of creating a class that stores metadata about a particular

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.