private void btnSave_Click(object sender, EventArgs e) { int error = 0; try { p1 = new NewProcess(); p1.name = boxName.Text; p1.ID = Convert.ToInt32(boxID.Text); p1.time = Convert.ToInt32(boxTime.Text); p1.IO = Convert.ToInt32(boxIO.Text); form.AddProcess(p1); } catch (Exception) { MessageBox.Show("Fill All Fields!"); error = 1; } if (error != 1) { boxName.Text = ""; boxTime.Text = ""; boxIO.Text = ""; int tempID = Convert.ToInt32(boxID.Text); tempID = tempID + 1; boxID.Text = tempID.ToString(); } }
public void AddProcess(NewProcess tempProcess) { //Create Strings of each process value and send to Data Grid View string ID = tempProcess.ID.ToString(); string name = tempProcess.name; string time = tempProcess.time.ToString(); string IO = tempProcess.IO.ToString(); string[] tempProcessArray = { ID, name, time, IO, "Ready" }; dataGridView.Rows.Add(tempProcessArray); //Add the process to processess list processesList.AddLast(tempProcess); }