private void listActivity() { string messageEmpty = String.Empty; if (txtSearchActivities.Text != String.Empty) { dtgListActivities.DataSource = ActivityDTO.getAllActivitiesToDisplay(txtSearchActivities.Text); messageEmpty = "Não há atividade com esse critério!"; } else { dtgListActivities.DataSource = ActivityDTO.getAllActivitiesToDisplay(); messageEmpty = "Não há atividade cadastrada!"; } if (dtgListActivities.Columns.Count > 0) { dtgListActivities.Columns[0].Visible = false; dtgListActivities.Visible = true; lblListActivitiesEmpty.Visible = false; } else { dtgListActivities.Visible = false; lblListActivitiesEmpty.Text = messageEmpty; lblListActivitiesEmpty.Visible = true; } }