private void btn_hideTitles_Click(object sender, EventArgs e) { string item_publisher = ""; foreach (var i in lstbx_publisher.SelectedIndices) { item_publisher += lstbx_publisher.Items[(int)i] + ";"; } item_publisher = item_publisher.TrimEnd(';'); //string[] PublisherName = item_publisher.Split(';'); string item_delta_New = ""; foreach (var i in lstbx_delta_New.SelectedIndices) { item_delta_New += lstbx_delta_New.Items[(int)i] + ";"; } item_delta_New = item_delta_New.TrimEnd(';'); //string[] Delta_New = item_delta_New.Split(';'); string item_filetype = ""; foreach (var i in lstbx_filetype.SelectedIndices) { item_filetype += lstbx_filetype.Items[(int)i] + ";"; } item_filetype = item_filetype.TrimEnd(';'); //string[] FileType = item_filetype.Split(';'); if (item_publisher.Length == 0 && item_delta_New.Length == 0 && item_filetype.Length == 0) { MessageBox.Show("Please make a Selection."); } else { SQLFunction sqlfnction = new SQLFunction(); sqlfnction.FlagTitlesToHide(str_Company, item_publisher, item_delta_New, item_filetype, lbl_CountOfTitles, lbl_Message); } }