![]() (object value) is implemented as follows in. Update 1 : some insides about this behavior However, since you are interested in user entered value, please use - TextBox.Text property instead of passing the TextBox. , Text: Shift SystemWindowsForm.TextBox, Text:Ĭonvert.ToString doesnt give you an error because one of it calls its overload with object - public static string ToString(object value). Name, Text: GlitterIDNumber 0Hourly rate The information I put into it is, Glitter for name, 12 for ID number, 1 for shift, and 12 for pay. Thanks to help from the commets I was able to fix the first problem I had, now I'm having a problem with the message box at the end. I have no idea how to fix the problem, hopefully its a little mistake. The string EmpShift thing is in there because I couldn't figure out how to work with the shift code more or less am using that as a place holder until I finger it out. The code itself isn't showing any errors, but when I try to run it I get: MessageBox.Show("Name " + EmployeeName + "IDNumber " + EmployeeNumber + "Hourly rate " + txtPay + "Shift " + txtShift) Private void btnShow_Click(object sender, EventArgs e) ProductionWorker.HourlyPayRate = Convert.ToInt32(txtPay.text) ĮmpShift = Convert.ToString(txtShift.text) ProductionWorker.EmployeeNumber = Convert.ToInt32(txtIdNumb.text) The shift field will be an integer value representing the shift that the employee works. The Production Worker class should have fields to hold the following formation: Shift (an integer) Hourly pay rate (a double) The workday is divided into two shifts: day and night. ![]() ProductionWorker.EmployeeName = txtName.ToString() ĮmployeeName = productionWorker.EmployeeName //Added mostly because I couldn't get EmployeeName to show anything in the messagebox Next, write a class named Production Worker that extends the Employee class. ProductionWorker productionWorker = new ProductionWorker() Private void btnGetInfo_Click(object sender, EventArgs e) Private void bt圎xit_Click(object sender, EventArgs e) Public partial class frmMainClasses : Form Here is the code I working on for it: using System Retrieve the object's properties and display their values. ![]() The day shift is shift 1 and the night shift is shift 2.Ĭreate an application that creates an object of the ProductionWorker class and lets the user enter data for each of the object's properties. The Shift property will hold an integer value representing the shift that the employee works. The workday is divided into two shifts: day and night.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |