private void addMedia() { //get data string title = TextBoxTitle.Text; string budget = TextBoxBudget.Text; string publishYear = TextBoxPublishYear.Text; string director = TextBoxDirector.Text; string language = TextBoxLanguage.Text; string genre = TextBoxGenre.Text; //check data (ensure no empty strigs) if (title.Length <= 0 || budget.Length <= 0 || publishYear.Length <= 0 || director.Length <= 0 || language.Length <= 0 || genre.Length <= 0) { MessageBox.Show("please fill in all fields"); return; } //convert publish year and budget string to int bool result = int.TryParse(publishYear, out int publishYearNum); if (!result) { MessageBox.Show("Media: error converting publishYear string to id int"); return; } result = int.TryParse(budget, out int budgetNum); if (!result) { MessageBox.Show("Media: error converting budget string to id int"); return; } //add new media item to table //string[] resultStrArr = mediaLogic.insertNewMedia(title, genre, director, language, publishYearNum, budgetNum); string[] resultStrArr = dtFunc.getStrArray(ws.insertNewMedia(title, genre, director, language, publishYearNum, budgetNum)); //dtFunc.consolePrintDT(ws.insertNewMedia(title, genre, director, language, publishYearNum, budgetNum)); if (resultStrArr[0] == "true") //isSuccessfull { getAndShowDataGridViews(); //refresh DataGridViews } else { //show error MessageBox.Show(resultStrArr[1]); } }