property name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rodchar

    property name

    hey all,

    how would i get the name of the property and not the value it's storing?

    For instance,

    Public Property mFirstName as String
    return _dr.firstName
    End property

    i just need the value "mFirstName " and not the value of it. How would i
    reference that?

    thanks,
    rodchar
  • rawCoder

    #2
    Re: property name

    Use Reflection.
    HTH
    rawCoder

    "rodchar" <rodchar@discus sions.microsoft .com> wrote in message
    news:08C9A1C7-3B1C-47B9-857C-81C8B3864645@mi crosoft.com...[color=blue]
    > hey all,
    >
    > how would i get the name of the property and not the value it's storing?
    >
    > For instance,
    >
    > Public Property mFirstName as String
    > return _dr.firstName
    > End property
    >
    > i just need the value "mFirstName " and not the value of it. How would i
    > reference that?
    >
    > thanks,
    > rodchar[/color]


    Comment

    • Cor Ligthert

      #3
      Re: property name

      Rodchar,

      I want the name of a fish do you know how I get it.

      The fish has a kind of sea silver colour.

      Trying to give you an anolygy how I understand your question

      :-)

      Cor


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: property name

        "rodchar" <rodchar@discus sions.microsoft .com> schrieb:[color=blue]
        > how would i get the name of the property and not the value it's storing?[/color]

        \\\
        Imports System.Reflecti on
        ..
        ..
        ..
        Public ReadOnly Property PropertyName() As String
        Get
        Return MethodBase.GetC urrentMethod(). Name
        End Get
        End Property
        ///

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • rodchar

          #5
          Re: property name

          thanks everyone, this helps.

          "Herfried K. Wagner [MVP]" wrote:
          [color=blue]
          > "rodchar" <rodchar@discus sions.microsoft .com> schrieb:[color=green]
          > > how would i get the name of the property and not the value it's storing?[/color]
          >
          > \\\
          > Imports System.Reflecti on
          > ..
          > ..
          > ..
          > Public ReadOnly Property PropertyName() As String
          > Get
          > Return MethodBase.GetC urrentMethod(). Name
          > End Get
          > End Property
          > ///
          >
          > --
          > M S Herfried K. Wagner
          > M V P <URL:http://dotnet.mvps.org/>
          > V B <URL:http://classicvb.org/petition/>
          >[/color]

          Comment

          Working...