.NET Control Arrays

I am just not getting it..... I am not sure what/how to ask differently, but I don't understand what my options are.

I have a piece of manufacturing equipment that was written and controlled in a VB6 application. This is now being converted to a VB.NET application. (VB 2013)
One form has 112 checkboxes that were used to display the status of real world discrete input & outputs to the machine. this was accomplished in VB6 through the use of checkboxes in a an array.
One group of the checkboxes, the inputs, were called In(0) through In In(79). The other group, the outputs, were called Out(80) through Out(111) for a total of 112.
The checked status let the operator know if the device was ON or OFF. Checked ==> ON, UNCHECKED ==> OFF.
This was accomplished through a loop
bDSig(xx) is a boolean variable that corresponds to the status of the real world input.

VB6 code

For IOLoop = 0 To 79
    If bDSig(IOLoop) = True Then
        frmIO.In(IOLoop).Value = 1
    Else
        frmIO.In(IOLoop).Value = 0
    End If
Next IOLoop

For IOLoop = 80 To 111
    If bDSig(IOLoop) = True Then
        frmIO.Out(IOLoop).Value = 1
    Else
        frmIO.Out(IOLoop).Value = 0
    End If
Next IOLoop

When I wizarded the original VB6 application it renamed the checkboxes _In_0, _In_1, _In_2, _Out_80, _Out_81, etc
I have gone through and renamed all the checkboxes In0, In1, In2, In3, Out80,, Out81, Out82, etc.
Is there now a way to loop these items to update them?
I need a very specific response on the way to do this in .NET world, I've tried asking this before and I am still struggling, and I'm not sure what I am missing. I have a lot of screens with a lot of information that I use to be able to just loop through to update, I am trying to understand the proper way to approach this.  I don't need a link, I need an example
Adam_930Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Dim i As Int16, s As String, s2 As String, chk As CheckBox
        For i = 1 To 3
            s = "CheckBox" + i.ToString
            chk = Me.Controls(s)

            s2 = s2 + s + " is " + chk.Checked.ToString + ","
        Next
        MessageBox.Show(s2)
the above will show you the state of 3 checkboxs - more or less what you want
0
Adam_930Author Commented:
Andy,
I am trying to assign the value of the many checkboxes,
I am trying to assign the checkbox.checked as either ON or OFF based on status of the input / outputs.

Example:I      In0.checked = bDSig(0)
0
AndyAinscowFreelance programmer / ConsultantCommented:
Trivial, a minor change
        Dim i As Int16, s As String, s2 As String, chk As CheckBox
        i = 2
        s = "CheckBox" + i.ToString
        chk = Me.Controls(s)
        chk.Checked = True

that will set the 2nd checkbox to ticked
Feel free to replace the word "CheckBox"  with whatever you have as the stub of the controls name
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Adam_930Author Commented:
Thanks Andy, I am starting to see what you are doing, but I am getting the error

A first chance exception of type 'System.NullReferenceException' occurred in frmIO.exe

when I get to line:     chk.Checked = True
0
AndyAinscowFreelance programmer / ConsultantCommented:
That sounds like the checkbox with the name you supply to me.Controls(...) was not found.  Please check the spelling xxx1 is not the same as Xxx1 for example.
Are these checkboxs on the form or on something else (eg. panel) on the form.  A panel would have its own collection of controls - eg. me.PanelXYZ.Controls(...)
0
Adam_930Author Commented:
This is what I currently have in my code:
My checkboxes are currently inside a GroupBox

        For i = 0 To 3
            s = "GroupBox1.In" + i.ToString
            chk = Me.Controls(s)
            chk.Checked = True
        Next

I used the copy & paste from the (Name) to make sure I didn't have a typo
I have tried with with and without the GroupBox1,
I have tried by adding Me.GroupBox1

I just tried moving my checkboxes to outside of my GroupBox and used the following

        For i = 0 To 3
            s = "In" + i.ToString
            chk = Me.Controls(s)
            chk.Checked = True
        Next

This worked, what am I missing inside the GroupBox???
0
AndyAinscowFreelance programmer / ConsultantCommented:
Close, you didn't read or understand part of my last comment

For i = 0 To 3
            s = "In" + i.ToString
            chk = Me.GroupBox1.Controls(s)
            chk.Checked = True
        Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Adam_930Author Commented:
THANK YOU VERY MUCH,
I have been struggling with this much longer than I want to admit.
I hope others can find your solution before they go through the pains I went through.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.