Replace Controls with other data?
Posted: Sat Dec 17, 2016 11:43 am
Hello,
working on it but can't replace them :(
i like to replace the existing controls in a listbox
but what do we wrong?
'loading the controls
Thanks
working on it but can't replace them :(
i like to replace the existing controls in a listbox
but what do we wrong?
'loading the controls
Code: Select all
'We want to replace the existing .countevents
Public Sub LOadingEvents()
Try
Dim attributes As String = "defaultstatus,statuscolor"
' ''if specifying a class id, create appropriate query
Dim empls As SQLiteDataReader = Database.executeQuery("SELECT " & attributes & " FROM colors ORDER BY defaultstatus DESC;")
While empls.Read() = True
Dim items As String() = New String(10) {}
items(0) = empls.GetValue(0).ToString
items(1) = empls.GetValue(1).ToString
Dim item As New SkinEventBar
If (Not String.IsNullOrEmpty(items(0))) Then
For i = 1 To 1 Step 1
With item
Dim str As [String] = items(1)
Dim clrConverter As New ColorConverter()
.Description = items(0)
.EventColor = DirectCast(clrConverter.ConvertFromString(str), Color)
.Countevents = 0
.Dock = DockStyle.Top
.Refresh()
End With
Next
End If
Me.Invoke(New InsertEventBar(AddressOf Me.Insertprogress), item)
End While
Catch ex As Exception
Exit Sub
End Try
End Sub
Private Delegate Sub InsertEventBar(ByVal lvi As SkinEventBar)
Private Sub Insertprogress(ByVal lvi As SkinEventBar)
lblevent.Controls.Add(lvi)
End Sub
Code: Select all
Anyone pleasePublic Sub ReplaceThem()
For Each itm As Control In lblevent.Controls
For Each c As Control In itm.Controls
If TypeOf c Is SkinEventBar Then
CType(c, SkinEventBar).Countevents =60
CType(c, SkinEventBar).Refresh()
End If
Next
Next
End Sub
Thanks