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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:22:12+00:00 2026-06-01T21:22:12+00:00

Say I’ve got the following variables: Public Shared x As String = 100 Public

  • 0

Say I’ve got the following variables:

Public Shared x As String = "100"
Public Shared y As String = "text"
Public Shared z As String = "something"

And I got a function:

Function giveVar(ByVal varName As String) As String 

    Return varName
End Function

But this doesn’t do what I want, naturally. What I want is that my function giveVar returns the value of the variable that holds giveVar. For example I call giveVar("x") I want my function to return "100".

Of course this can be done by a Select Case but thats not what I like to do. Does anyone has any suggestion?
Is it even possible to call a value based on a string?

[edit:]

Namespace i18n
    public NotInheritable Class Settings
        Public Shared LanguageCode As String
        Public Shared HideAllLocalizedText As Boolean
    End Class

Public NotInheritable Class i18n
        Private Sub New()

        End Sub

        Public Shared Function t(ByVal varName As String) As String
            Select Case Settings.LanguageCode
                Case "en"
                    Return en(varName)
                Case Else
                    Return nl(varName)
            End Select
        End Function

        Private Shared Function en(ByVal varName As String) As String
            Dim ASP_0344 As String = "Cancel"
            Dim ASP_0807 As String = "Click"
            Dim ASP_0808 As String = "here"
            Dim ASP_0812 As String = "Welcome at the login screen..."

            ' These are examples there is a whole bigger list               

            Return CallByName(Me, varName, vbGet)
        End Function

        Private Shared Function nl(ByVal varName As String) As String
            Dim ASP_0344 As String = "Annuleren"
            Dim ASP_0807 As String = "Klik"
            Dim ASP_0808 As String = "hier"
            Dim ASP_0812 As String = "Welkom op het inlogscherm..."

            Return CallByName(Me, varName, vbGet)
        End Function

    End Class
End Namespace

I think this works so far, BUT I get the following error on the CallByName(Me, varName, vbGet) at the Me : "me is only valid within an instance method"

  • 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-01T21:22:15+00:00Added an answer on June 1, 2026 at 9:22 pm

    Try

    CallByName (Me, "x", VbGet)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following: namespace SomeProject { public interface ISomething { string SomeMethod();
Say I have the following template function: template <class T> void apply(const vector<complex<T> >&
Say I've got this array: MyArray(0)=aaa MyArray(1)=bbb MyArray(2)=aaa Is there a .net function which
Say using following function: getUnique(){ MyObject obj = getValueFromDb(); obj.modifyIt(); obj.commit(); } When simultaneous
Say I have the following: class Base { public Base (int n) { }
Say I have the following generic class: public class Foo<T extends Bar> { //
Say we have the following code: public interface Rock { // Minerals are a
Say I have a couple of basic objects like so: [Serializable] public class Base
Say I have real, dimension(0:100) :: realResults and I want to iterate over realResults
Say I have a SqlAlchemy model something like this: from sqlalchemy.ext.declarative import declarative_base from

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.