private void btnSave_Click_1(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.arrTime = Convert.ToInt32(boxIO.Text); AddProcess(p1); } catch (Exception) { MessageBox.Show("Please 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(); } }
///////form2 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 arrTime = tempProcess.arrTime.ToString(); string[] tempProcessArray = { ID, name, time, arrTime, "Ready" }; dataGridView.Rows.Add(tempProcessArray); processesList.AddLast(tempProcess); }