Variable with other variable

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

    #1

    Variable with other variable

    Hi

    How can I include in name of my variable value of other variable? I
    have following code:


    For x = 0 To 10

    Dim column As New DataGridTextBox Column
    column.MappingN ame = magazyny(x)
    column.HeaderTe xt = magazyny_wys(x)
    column.Width = 100
    TblStyle.GridCo lumnStyles.Add( column)

    Next

    and what i can do with variable Column?! I need sth like that:

    Dim column + x As New DataGridTextBox Column

    Or maybe u know other way to add several columns to tablestyle using
    For loop

    Thx Mrozu

  • Göran Andersson

    #2
    Re: Variable with other variable

    Why do you think that you need that? Is there some problem with the code
    as it is now?

    You can use an array if you want to keep references to the columns.

    Mrozu wrote:[color=blue]
    > Hi
    >
    > How can I include in name of my variable value of other variable? I
    > have following code:
    >
    >
    > For x = 0 To 10
    >
    > Dim column As New DataGridTextBox Column
    > column.MappingN ame = magazyny(x)
    > column.HeaderTe xt = magazyny_wys(x)
    > column.Width = 100
    > TblStyle.GridCo lumnStyles.Add( column)
    >
    > Next
    >
    > and what i can do with variable Column?! I need sth like that:
    >
    > Dim column + x As New DataGridTextBox Column
    >
    > Or maybe u know other way to add several columns to tablestyle using
    > For loop
    >
    > Thx Mrozu
    >[/color]

    Comment

    • Mrozu

      #3
      Re: Variable with other variable

      God... it really works... I don't know what's going on:) Thx man.

      But is it possible to add to variable name value of other variable?


      Thx Mrozu

      Comment

      • Göran Andersson

        #4
        Re: Variable with other variable

        No, there is no way to create variables dynamically. If you want to
        store named values dynamically you should use a collection. Or if the
        names only differ by index like in your example, an array.

        Mrozu wrote:[color=blue]
        > God... it really works... I don't know what's going on:) Thx man.
        >
        > But is it possible to add to variable name value of other variable?
        >
        >
        > Thx Mrozu
        >[/color]

        Comment

        Working...