Home All Groups Group Topic Archive Search About

TRYING to INDEX a FORM

Author
16 Apr 2005 11:28 PM
Daniel Kaseman
WHY can't I do this?

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        Dim i As Byte
        For i = 1 To 10
            Me("textbox" & i) = i
        Next
    End Sub

Author
16 Apr 2005 11:41 PM
Herfried K. Wagner [MVP]
"Daniel Kaseman" <d**@cfaith.com> schrieb:
>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>        Dim i As Byte
>        For i = 1 To 10
>            Me("textbox" & i) = i
>        Next
>    End Sub

First:  Using 'Byte' as type of index variables is not a good idea, it's
better to use 'Integer' instead.

Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
17 Apr 2005 12:05 AM
Daniel Kaseman
Thank you, that worked.

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23QELV1tQFHA.576@TK2MSFTNGP15.phx.gbl...
> "Daniel Kaseman" <d**@cfaith.com> schrieb:
>>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Button1.Click
>>        Dim i As Byte
>>        For i = 1 To 10
>>            Me("textbox" & i) = i
>>        Next
>>    End Sub
>
> First:  Using 'Byte' as type of index variables is not a good idea, it's
> better to use 'Integer' instead.
>
> Accessing controls by their names or indices
> <URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>