- Where Developers Learn, Share, & Build Careers
I have a C # project, and I have created a class named Employee. This is my new list inside the class:
list & lt; Employee & gt; Employee = new list & amp; Staff; & Gt; (); How can I create a query that will add items to the list on a particular event?
Here is the full square:
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Class employee {public string worker id; Public string employeeLlastName; Public string employeeFirstName; Public double employee payett; Public int employee; Public staff staff employee; Public Employee (String EID, String Elevation, String Eiffel-Names, String Eiffel, Double Eapet, Int EHours, Bull EFT) {this.employeeID = eID; This.employeeListName = eLastName; This.employeeFirstName = eFirstName; This.employeeID = ePhone; This.employeePayrate = ePayrate; this. The employee = eHours; This.employeeFT = EFT; } Fixed Zero Main () {List & lt; Employee & gt; Employee = new list & amp; Staff; & Gt; (); Staff. Add (New Employee ("Amtsbus_e1", "Mortaza", "Mirza", "615-898-2323", 10, 90, Correct)); Staff. Add (new employee ("Amtsbus_E2", "Re", "Angie", "615-898-2323", 11, 80, Satya)); Staff. Add (new employee ("Emmysbas_E3", "Burton", "James", "615-898-2323", 12, 70, Incorrect)); Staff. Add (new employee ("mtsubas_e4", "bullard", "dual", "615-898-2323", 13, 60, true)); Staff. Add (New Employee ("Emmysbas_E5", "Epigen", "Charlie", "615-898-2323", 14, 50, Truth)); Staff. Add (new employee ("mtsubas_e6", "Lee", "Jung-Song", "615-898-2323", 15, 90, verse)); Staff. Add (new employee ("mtsubas_e7", "mine", "li", "615-898-2323", 16, 70, wrong)); Staff. Add (New Employee ("Amtsbus_A 8", "Bamnziri", "Temi", "615-898-2323", 17, 60, Satya)); Staff. Add (new employee ("mtsubas_e 9", "greer", "matte", "615-898-2323", 18, 50, true)); Staff. Add (new employee ("mtsubas_e10", "Cornell", "Carlos", "615-898-2323", 19, 80, Wrong)); }}
You should provide a public law that adds new employees to the archive
Public Class Form 1: Form {Public Zero AddEmployee (Employee Employ) {employees.Add (empl); }} And then you can use this method in a different way (you need references to it).
Public category form 2: form {readonly form 1 _manform; Public form 2 (Form 1 key form) {_mainForm = mainForm; } Private Zero button click on {_mainForm.AddEmployee (new employee (text box 1 text, text box 2. text / * etc * /))}}
Comments
Post a Comment