How can I read values from multiple textboxes into a 2-D array in VB.NET?

AI Thread Summary
In VB.Net, creating a procedure to read values from multiple textboxes into a 2-D array can be challenging, especially for newcomers. The user is attempting to utilize a nested for/next loop to iterate through a 4x4 matrix but is unsure how to reference the textboxes correctly. The concept of control arrays, which allowed for easier management of multiple controls in VB6, is not directly supported in VB.Net, leading to frustration. Although there are methods to simulate control arrays in VB.Net, they can be complex and cumbersome. It is recommended to explore VB.Net forums for detailed guidance on this topic.
debwaldy
Messages
34
Reaction score
0
Hi I am a new-comer to VB.Net & I am working with arrays at the moment.i want to write a procedure that accepts two 2-D arrays(max size being a 4*4 matrix).
i don't know how i could get the procedure to read in these values from the sixteen different textboxes i have created...i started using a for/next loop to go through each row as shown below:

Dim i, j, n, m As Integer
Dim a As Double(,)
a = New Double(i, j) {}
For i = 0 To a.GetUpperBound(i)
For j = 0 To a.GetUpperBound(j)
a(i, j) = TextBox

its here that I am stuck i want it to go through each row of textboxes row by row and read in the values input by the user.would some sort of inner loop again work...or is there a much easier way to do this...any help is much appreciated :biggrin:
 
Computer science news on Phys.org
debwaldy said:
Hi I am a new-comer to VB.Net & I am working with arrays at the moment.i want to write a procedure that accepts two 2-D arrays(max size being a 4*4 matrix).
i don't know how i could get the procedure to read in these values from the sixteen different textboxes i have created...i started using a for/next loop to go through each row as shown below:

Dim i, j, n, m As Integer
Dim a As Double(,)
a = New Double(i, j) {}
For i = 0 To a.GetUpperBound(i)
For j = 0 To a.GetUpperBound(j)
a(i, j) = TextBox

its here that I am stuck i want it to go through each row of textboxes row by row and read in the values input by the user.would some sort of inner loop again work...or is there a much easier way to do this...any help is much appreciated :biggrin:
Yeah, this is a frustration w/ VB.NET, after such things (called "control arrays") that were so easy in VB6 got tossed out in VB.NET

There ARE ways to create control arrays in VB.NET but it's quite ugly. I suggest a search on one of the VB.NET forums. The details are just too messy for me to want to go into here in a post.
 
  • Like
Likes Greg Bernhardt
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...

Similar threads

Replies
4
Views
11K
Replies
11
Views
3K
Replies
10
Views
25K
Replies
12
Views
3K
Replies
6
Views
2K
Replies
1
Views
2K
Replies
0
Views
3K
Back
Top