Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can one display the members of an array of integers into textboxes that have been grouped together in visual basic 2008
thanks in advance


I mean

Public group1 As New List(Of Control)

Public Sub assign()

group1.Add(Me.textbox1)
group1.Add(Me.textbox2)
group1.Add(Me.textbox3)
group1.Add(Me.textbox4)
group1.Add(Me.textbox5)
group1.Add(Me.textbox6)
group1.Add(Me.textbox7)
group1.Add(Me.textbox8)
group1.Add(Me.textbox9)
group1.Add(Me.textbox10)
Dim i As Integer
Dim arraylist(7) As Integer


arraylist(0) = 1
arraylist(1) = 2
arraylist(2) = 3
arraylist(3) = 4
arraylist(4) = 5
arraylist(5) = 6
arraylist(6) = 7
arraylist(7) = 8

For i = 0 To UBound(subject)
For Each A In mon1
If TypeOf A Is TextBox Then
A.Text = A.Text & arraylist(i).ToString & vbCrLf
End If
Next (A)
Next
end sub

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call assign()
End Sub


the problem is that I cannot figure out how to make sure each textbox in the group does not display the same number..
kindly advice on the way foward or better altenative
Posted
Updated 10-Mar-23 12:33pm
v3

1 solution

VB
dim I as integer
dim arr(5) as integer

for I = 0 to ubound(arr)
    textbox1.text = textbox1.text & arr(I).tostring & vbcrlf
next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900