Torna al Thread
[CODE]
Dim temp As Label() = New Label(dt.Rows.Count) {}
For Each myRows In dt.Rows
'VERIFICO LO STATUS DELLA SOTTOSESSIONE
Dim STLabel As Integer = 0
Sql = "SELECT COUNT(*) AS n FROM NewMac_Profili "
Sql = Sql + "WHERE NewMac_Profili.newmac_id = " + GeneralModel.IdDoc.ToString + " AND NewMac_Profili.main_code = '" + myRows("main_code") + "' AND NewMac_Profili.sub_code <> '00' AND NewMac_Profili.check_keypoint = 0"
Dim command As New OleDb.OleDbCommand(Sql, db.istance)
Dim reader As OleDb.OleDbDataReader = command.ExecuteReader()
reader.Read()
If reader("n") = 0 Then
STLabel = 1
Else
STLabel = 0
End If
'VERIFICO LO STATUS DELLA SOTTOSESSIONE
temp(CNT) = New Label
With temp(CNT)
' Set the properties of the Label here ...
.Location = New System.Drawing.Point(X, Y)
.Size = New System.Drawing.Size(300, 20)
.TextAlign = ContentAlignment.MiddleLeft
.ForeColor = System.Drawing.Color.White
.BackColor = System.Drawing.Color.Transparent
.Font = myfont
.Cursor = Cursors.Hand
.ImageList = ImageList1
.ImageIndex = STLabel
.ImageAlign = ContentAlignment.MiddleLeft
temp(CNT).Name = myRows("main_code")
' Now, tell the Label what function to use when clicked.
If GeneralModel.language = "ITA" Then
temp(CNT).Text = " " + myRows.Item("desc_ita")
ElseIf GeneralModel.language = "ENG" Then
temp(CNT).Text = " " + myRows.Item("desc_eng")
End If
AddHandler .Click, myDelegate
End With
Me.Controls.Add(temp(CNT))
CNT += 1
Y = Y + 20
Next
[/CODE]