Not sure about that method, but this is one way using a ListBox that may give you what you want:
For Each x As Object In Me.Controls
Try
ListBox1.Items.Add(x.plcAddressText)
Catch ex As Exception
End Try
Try
ListBox1.Items.Add(x.plcAddressValue)
Catch ex As Exception
End Try
Next
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's what i was trying to do! But, now, i'd like to get each control listed out into separate arrays, say filtering by DigitalMeter, Gauge etc?
I tried this but it didn't work:
For Each DigitalMeter As Object In Me.Controls
Try
ListBox1.Items.Add(DigitalMeter.plcAddressText)
Catch ex As Exception
End Try
Next
It just gives me all of the controls in one go?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm using this code:
textbox1.lines = Me.Controls.OfType(Of Box).Select(Function(b) b.PLCaddress).Reverse.ToArray
to get the plc addresses from all of my controls, however, when i run it in advancedHMI i get this error:
'oftype' is not a member of 'system.windows.forms.control.controlcollection'.
Any ideas, thanks?
Not sure about that method, but this is one way using a ListBox that may give you what you want:
For Each x As Object In Me.Controls
Try
ListBox1.Items.Add(x.plcAddressText)
Catch ex As Exception
End Try
Try
ListBox1.Items.Add(x.plcAddressValue)
Catch ex As Exception
End Try
Next
That's what i was trying to do! But, now, i'd like to get each control listed out into separate arrays, say filtering by DigitalMeter, Gauge etc?
I tried this but it didn't work:
For Each DigitalMeter As Object In Me.Controls
Try
ListBox1.Items.Add(DigitalMeter.plcAddressText)
Catch ex As Exception
End Try
Next
It just gives me all of the controls in one go?