can you tell me where exactly i make wrong, because for me its returning me always the ELSE statement "Please select checkbox"
so i will start 1 by 1 what i added:
1. Button code:
Private Sub btnTaskDone_Click(sender As Object, e As EventArgs) Handles btnTaskDone.Click
Dim recordsToUpdate = FlowLayoutPanel3.Controls.OfType(Of UserTasks)().
Where(Function(ut) ut.CheckBox1.Checked And ut.Status = "").
Select(Function(x) CStr(x.Tag))
If recordsToUpdate?.Any() Then
'At least one CheckBox in myGroupBox is checked.
'MsgBox("Checkbox Selected.", MsgBoxStyle.OkOnly, "Yeyy!")
For Each recordId In recordsToUpdate
UpdateTasksDB(recordId)
Next
DisplayTasksCount() 'Refresh
GenerateTasksUser() 'Refresh
Alert("Tasks were Updated", CustomNotifications.EnmType.Success)
Else
Alert("Please select first some Tasks", CustomNotifications.EnmType.Error)
End If
End Sub
2. UserTasks added
Public _status As String
Public Property Status As String
Get
Return _status
End Get
Set(value As String)
_status = value
End Set
End Property
3. GenerateTasks
Public Sub GenerateTasksUser()
FlowLayoutPanel3.Controls.Clear()
Dim dt As DataTable = New ClassBLL().GetTasksUser()
If dt IsNot Nothing Then
If dt.Rows.Count > 0 Then
Dim listItems As UserTasks() = New UserTasks(dt.Rows.Count - 1) {}
For i As Integer = 0 To 1 - 1
For Each row As DataRow In dt.Rows
Dim listItem As New UserTasks()
listItems(i) = listItem
listItems(i).Width = FlowLayoutPanel3.Width - 24
listItems(i).TaskTitle = row("taskstitle").ToString()
listItems(i).TaskSubject = row("tasksubject").ToString()
listItems(i).TaskFrom = row("taskfromname").ToString()
listItems(i).Tag = row("ID").ToString()
listItems(i).CheckBoxText = row("taskstatus").ToString
listItems(i).Status = row("taskstatus").ToString
If listItems(i).CheckBoxText = "Completed" Then
listItems(i).CheckBoxCheck = True
Else
listItems(i).CheckBoxCheck = False
End If
FlowLayoutPanel3.Controls.Add(listItems(i))
Next
Next
End If
End If
End Sub
But it returns me ELSE statement, where i miss something ?
Edit: Found it
it should be like this:
ut.Status <> "Completed").
Now works :)