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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:42:17+00:00 2026-06-05T15:42:17+00:00

OK, that question sounds maybe a little confusing so I’ll try to explain it

  • 0

OK, that question sounds maybe a little confusing so I’ll try to explain it with an example.

Pretend you have an object like this:

Class Something
    Private varX As New Integer
    Private varY As New String

'[..with the associated property definitions..]

    Public Sub New()
    End Sub

End Class

And another with:

Class JsonObject
    Inherits Dictionary(Of String, String)

    Public Function MakeObject() As Object 'or maybe even somethingObject 
        Dim somethingObject As New Something()

        For Each kvp As KeyValuePair(Of String, String) In Me
            'Here should happen something to use the Key as varX or varY and the Value as value for the varX or varY
            somethingObject.CallByName(Me, kvp.Key, vbGet) = kpv.Value

        Next

        return somethingObject
    End Function

End Class

I’ve got the ‘CallByMe()’ function from a previous question of myself

  • 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-05T15:42:18+00:00Added an answer on June 5, 2026 at 3:42 pm

    CallByName works different from the way you are trying to use it. Look at the documentation, it will tell you that in this particular case the correct usage would be

    CallByName(Me, kvp.Key, vbSet, kpv.Value)
    

    However, the function CallByName is part of a VB library that isn’t supported on all devices (notably it isn’t included in the .NET Mobile framework) and consequently it’s better not to use it.

    Using proper reflection is slightly more complicated but guaranteed to work on all platforms.

    Dim t = GetType(Something)
    Dim field = t.GetField(kvp.Key, BindingFlags.NonPublic Or BindingFlags.Instance)
    field.SetValue(Me, kvp.Value)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question sounds a lot like a bunch of others that are
This probably sounds like a stupid question, but I'm going to give it a
Ok this maybe sound like the worst question on stackoverflow but here it is.
This is my first question in StackOverflow, so I would try to explain my
I know this question might sound a little bit crazy, but I tough that
I am sorry, that sounds like a noob question. I am trying to do
My question sounds like something that should come up with a simple google search
This sounds like a pretty easy question to answer but I haven't been able
I have a question that may sound odd, but being somewhat of a newbie,
This question is sort of a sequel to that question. When we want to

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.