codice:Form1 dim F as object F = New NewForm(OneGroup.Name, OneGroup.ClientHandle, AnOPCItemIDs) F.UpdateValue(ClientHandles, ItemValues) Public Class NewForm Public Sub New(ByVal Name As String, ByVal ID As Long, ByVal AnOPCItemIDs() As String) Try Dim NewForm As New Form() NewForm.Text = "Gruppo: " & Name NewForm.AutoSize = True NewForm.Show() Dim listitem As New ListBox Dim List As New ListBox List.Location = New System.Drawing.Point(0, 0) List.Height = 100 : List.Width = 300 NewForm.Controls.Add(List) listitem.Location = New System.Drawing.Point(0, List.Height + 10) listitem.Height = 200 : listitem.Width = 300 NewForm.Controls.Add(listitem) List.Items.Add("Gruppo: " & Name) List.Items.Add("ServerHeader: " & ID) For i = 1 To AnOPCItemIDs.Length - 1 If AnOPCItemIDs(i) Is Nothing Then Exit For Else listitem.Items.Add(AnOPCItemIDs(i)) End If Next Catch ex As Exception MessageBox.Show("Error: " + ex.Message + Chr(13) + ex.ToString, "Exception", MessageBoxButtons.OK) End Try End Sub Public Sub UpdateValue(ByVal ClientHandles As System.Array, ByVal ItemValues As System.Array) ', Byval optional qualities As System.Array, ByRef timestamp As System.Array) Try For cnItem = LBound(ClientHandles) To UBound(ClientHandles) 'listitem.Items.Add(ClientHandles(cnItem) & " " & ItemValues(cnItem)) Next Catch ex As Exception MessageBox.Show("Error: " + ex.Message + Chr(13) + ex.ToString, "Exception", MessageBoxButtons.OK) End Try End Sub End Class

Rispondi quotando