I hope this question enlightens me about my problem and don't lead me to negative posts.
I will try my best to explain the question.
Here it is.
I have a datagridview and it looks like this
and I have a
'Sample but not working
For Each row As DataGridViewRow In DataGridView1.Rows
"Control Name".Enabled = "Access"
Accessing the row cell's values happens using the Name of the column as Indexer in the Cells collection. Then finding the relative control can be done using the Form (Me) controls collection
Public Sub EnablePictures() Dim Enable As Boolean For Each row As DataGridViewRow In DataGridView1.Rows Enable = Convert.ToBoolean(row.Cells("Access").Value) Dim ctrl = Me.Controls(row.Cells("Control Name").Value) if ctrl IsNot Nothing Then ctrl.Enabled = Enable End If Next End Sub
This code makes a lot of assumptions. First you columns should be exactly named as appears in your image (I see the Header caption, not the real column name) and then I assume that you have the PictureBoxes as childs of the forms controls collection. If they are contained in a different control (groupbox, panel...) you should use the Controls collection of that container.
I have created a Sub from the previous code to help you in your problem stated in the comments below. In this way you could call this sub whenever you need it. So if you add picurebox controls dynamically you can call the sub just after adding them to your form