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

Recommended Answers

All 2 Replies

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.