Home All Groups Group Topic Archive Search About

Variable with other variable

Author
6 May 2006 11:49 AM
Mrozu
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 DataGridTextBoxColumn
            column.MappingName = magazyny(x)
            column.HeaderText = magazyny_wys(x)
            column.Width = 100
            TblStyle.GridColumnStyles.Add(column)

Next

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

Dim column + x As New DataGridTextBoxColumn

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

Thx Mrozu

Author
6 May 2006 1:01 PM
Göran_Andersson
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:
Show quoteHide quote
> 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 DataGridTextBoxColumn
>             column.MappingName = magazyny(x)
>             column.HeaderText = magazyny_wys(x)
>             column.Width = 100
>             TblStyle.GridColumnStyles.Add(column)
>
> Next
>
> and what i can do with variable Column?! I need sth like that:
>
> Dim column + x As New DataGridTextBoxColumn
>
> Or maybe u know other way to add several columns to tablestyle using
> For loop
>
> Thx Mrozu
>
Author
6 May 2006 2:49 PM
Mrozu
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
Author
6 May 2006 5:55 PM
Göran_Andersson
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:
Show quoteHide quote
> 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
>