I'm making startlist so obviously I want to prevent that there would be competitors with same start number. I have TextBoxes for input values with Save button convert to DataGridView table. Like so:
bool CheckFiledIsEmpty(){if(textStN.Text==string.Empty||
textN.Text==string.Empty||
textSN.Text==string.Empty||
textC.Text==string.Empty||
textYB.Text==string.Empty)returnfalse;elsereturntrue;}privatevoid buttonSave_Click(object sender,EventArgs e){if(CheckFiledIsEmpty()){stringColumn1= textStN.Text;stringColumn2= textN.Text;stringColumn3= textSN.Text;stringColumn4= textC.Text;stringColumn5= textYB.Text;string[] row ={Column1,Column2,Column3,Column4,Column5};
dataGridView1.Rows.Add(row);
textStN.Text="";
textN.Text="";
textSN.Text="";
textC.Text="";
textYB.Text="";}else{MessageBox.Show("Input all information about competitor!");}}
I want that when the Save button is hit, the former values in Column1
(start
number textbox textStN
)
are checked and if there is same value the error box like: "The competitor with that start number already exists!"
Thanks for help and sorry for my English.