private void BtnMediaLibarySearch_Click(object sender, EventArgs e) { //which radio btn are we seraching by // should return string // title / year / genre / none string activeRadio = getActiveRadioBtn(); //get text box data //ensure not empty String userSearch = TextBoxMediaLibarySearchField.Text; if (userSearch.Length <= 0) { MessageBox.Show("Please input your seach by text / num in the text box."); } else { switch (activeRadio) { case "none": MessageBox.Show("Please select an active Category Radio Button"); break; case "title": //DataGridViewMediaLibary.DataSource = mediaLogic.getMediaByTitle(userSearch); DataGridViewMediaLibary.DataSource = ws.getMediaByTitle(userSearch); break; case "year": int year = 0; bool result = int.TryParse(userSearch, out year); if (result) { //DataGridViewMediaLibary.DataSource = mediaLogic.getMediaByYear(year); DataGridViewMediaLibary.DataSource = ws.getMediaByYear(year); } else { MessageBox.Show("Could not convert your year to a number try again."); } break; case "genre": //DataGridViewMediaLibary.DataSource = mediaLogic.getMediaByGenre(userSearch); DataGridViewMediaLibary.DataSource = ws.getMediaByGenre(userSearch); break; default: MessageBox.Show("Somthing went wrong try again -- Switch Default"); break; } } }