0

Hello sir,
In a label i am having data like this 12/9/2009.
With split function i splitted numbers as 12, 9 , 2009. I want this numbers to be stored in LabelArray as Integers
Label1 = 12
Label2 = 9
Label3 = 2009
So i used this coding, but with this i am getting only 2009 in all the 3 labels.

Dim LabelArray(3) As Label
        LabelArray(0) = Label1
        LabelArray(1) = Label2
        LabelArray(2) = Label3
        Dim strData As String = Label15.Text
        ' Dim separator As Char[] {"/"}
        Dim words As String() = strData.Split(New Char() {"/"})
        Dim word As Integer
        For i = 0 To 2
            For Each word In words
                LabelArray(i).Text = word
            Next
        Next
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bharanidharanit
0

Nested loop is a problem.

For i = 0 To 2
       LabelArray(i).Text = word(i)
 Next

or

i=0
For Each word In words
  LabelArray(i).Text = word
  i=i+1
Next
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.