Change Property Dinamically

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

    #1

    Change Property Dinamically

    I got a table with for example 10 fields, field001, field002 ...field010

    what i want is do something like this

    For i As Integer = 1 To 10
    (table.field00 & i).value = "XX"
    Next i

    any ideas??


  • Cor Ligthert[MVP]

    #2
    Re: Change Property Dinamically

    srcp.

    What do you mean with a table is that something to eat from.

    As it is a datarow then it is simple

    for i = 0 to 9
    datarow.item(i) = "XX"
    next

    Assumming all fields are strings

    Giving some more information mostly give better answers.

    Cor

    "srcp" <sergiocp@intel nett.comschreef in bericht
    news:ehd8Bbz1IH A.4848@TK2MSFTN GP05.phx.gbl...
    >I got a table with for example 10 fields, field001, field002 ...field010
    >
    what i want is do something like this
    >
    For i As Integer = 1 To 10
    (table.field00 & i).value = "XX"
    Next i
    >
    any ideas??
    >

    Comment

    • rowe_newsgroups

      #3
      Re: Change Property Dinamically

      On Jun 25, 10:51 pm, "srcp" <sergi...@intel nett.comwrote:
      I got a table with for example 10 fields, field001, field002 ...field010
      >
      what i want is do something like this
      >
      For i As Integer = 1 To 10
               (table.field00 & i).value = "XX"
      Next i
      >
      any ideas??
      I'm not really sure what you're trying to accomplish here, but if it's
      what I think than you need to read up on Reflection,
      Type.GetPropert ies, PropertyInfo, and PropertyInfo.Se tValue.

      Thanks,

      Seth Rowe [MVP]

      Comment

      • Phill W.

        #4
        Re: Change Property Dinamically

        srcp wrote:
        I got a table with for example 10 fields, field001, field002 ...field010
        what i want is do something like this
        For i As Integer = 1 To 10
        (table.field00 & i).value = "XX"
        If we're talking DataTables here, then they don't have Fields; DataRows
        /within/ a Datatable do. In that case, you could so something like this:

        Dim dr as DataRow = ...

        For i As Integer = 1 To 10

        Dim sFieldName as String _
        = String.Format( "Field{0:00 0}", i )

        dr.Item( sFieldName ) = "XX"
        Next

        HTH,
        Phill W.

        Comment

        • srcp

          #5
          Re: Change Property Dinamically

          Thanks Cor, being more acurate in what i'm trying to do:

          ' Create a proxy from SAP
          Public Proxy As new SAPProxy(dtSap. ConnectionStrin g)

          Dim myR3Table as New ZtestTable

          Proxy.Connectio n.Open()

          'I've already importe a function that fill a table defined in SAP

          Proxy.zhr_rfc_f illTable(myR3Ta ble)

          By doing this i fill the table myR3Table, this is only a structure defined
          in SAP system.



          Thanks for your Help.

          Sergio.



          "Cor Ligthert[MVP]" <notmyfirstname @planet.nlwrote in message
          news:11B190B8-508C-4907-887B-44B880874A6E@mi crosoft.com...
          srcp.
          >
          What do you mean with a table is that something to eat from.
          >
          As it is a datarow then it is simple
          >
          for i = 0 to 9
          datarow.item(i) = "XX"
          next
          >
          Assumming all fields are strings
          >
          Giving some more information mostly give better answers.
          >
          Cor
          >
          "srcp" <sergiocp@intel nett.comschreef in bericht
          news:ehd8Bbz1IH A.4848@TK2MSFTN GP05.phx.gbl...
          >>I got a table with for example 10 fields, field001, field002 ...field010
          >>
          >what i want is do something like this
          >>
          >For i As Integer = 1 To 10
          > (table.field00 & i).value = "XX"
          >Next i
          >>
          >any ideas??
          >>
          >

          Comment

          • srcp

            #6
            Re: Change Property Dinamically

            Thanks Seth, what i'm trying to do is changing a property for a set of
            objects (in this case a row of a sap r3 table, but it can be a textbox,
            button, etc) but doing it in just one line, i mean creating the name of the
            object in runtime.


            "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
            news:bcb06a8b-3a5e-4b9d-ab19-d5baec49e32d@f3 6g2000hsa.googl egroups.com...
            On Jun 25, 10:51 pm, "srcp" <sergi...@intel nett.comwrote:
            I got a table with for example 10 fields, field001, field002 ...field010
            >
            what i want is do something like this
            >
            For i As Integer = 1 To 10
            (table.field00 & i).value = "XX"
            Next i
            >
            any ideas??
            I'm not really sure what you're trying to accomplish here, but if it's
            what I think than you need to read up on Reflection,
            Type.GetPropert ies, PropertyInfo, and PropertyInfo.Se tValue.

            Thanks,

            Seth Rowe [MVP]



            Comment

            Working...