0
Answer

Cannot convert type 'char'

Manu xaml

Manu xaml

15y
2k
1
The line where I get the error is the following (bottom of cod)
correctionsManager.DeleteCorrectionsForInspection(differentItems[1].Trim(), currentJob.JobID)) ;

differentItems[1].Trim() contains just some text e.g. "This is me" why am I getting this error then and how can I pass it to my .cs file?

Thanks
Em
 



private void cmdRemove_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < lstViolationCodesSelected.SelectedItems.Count; i++)
            {
                
                string[] differentItems = lstViolationCodesSelected.SelectedItems[i].ToString().Split('^');
                

                if (differentItems[1].IndexOf(" (AD_HOC)") > 0)
                {
                    if (selectedCodesDescription.Contains(differentItems[1]))
                    {
                        selectedCodesDescription.RemoveAt(i);
                    }
                }
                if (selectedCodesText.Contains(differentItems[1].Trim()))
                {
                    //Remove also from checkboxes
                    selectedCodesText.Remove(differentItems[1].Trim());
                    selectedCodes.Remove(differentItems[0].Trim());
                    lstViolationCodesSelected.Items.Remove(lstViolationCodesSelected.SelectedItems[i]);  
                }

                selectedCodesText.Remove(differentItems[1].Trim());
                lstViolationCodesSelected.Items.RemoveAt(lstViolationCodesSelected.Items.IndexOf(lstViolationCodesSelected.SelectedItems[i]));

                txtDisplay.Text = "";

                //Do the update in the Database // GetCorrectionsForInspection " + currentJob.JobID + "
                // GOOD CODE foreach (Corrections cor in correctionsManager.DeleteCorrectionsForInspection(currentJob.JobID))
                // btn.Uid.ToString()

                MessageBox.Show("You have just selected " + differentItems[1].Trim() + " " + currentJob.JobID);
            
                foreach (Corrections cor in correctionsManager.DeleteCorrectionsForInspection(differentItems[1].Trim(), currentJob.JobID)) ;

            }
        }