i need to do the second part of the assignment
and i cant solve it, i need to do it gui,
this is what i have so far

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EmployeeExceptionDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int id;
        double wage;
       // Employee[] emp = new Employee[10];
        double[] emp = new double[10];
        private void button1_Click(object sender, EventArgs e)
        {


            for (int i = 0; i < 10; i++)
            {
             
                id = Convert.ToInt32(Console.ReadLine());
                wage = Convert.ToDouble(Console.ReadLine());
            }
            //display data
            label6.Text = ("Display Employee Details\n");
            label6.Text = ("IDNumber     HourlyWage");
            for (int i = 0; i < 10; i++)
                //emp[i].show();


            emp[0] = Convert.ToDouble(textBox1.Text);
            emp[1] = Convert.ToDouble(textBox2.Text);
            emp[2] = Convert.ToDouble(textBox3.Text);
            emp[3] = Convert.ToDouble(textBox4.Text);
            emp[4] = Convert.ToDouble(textBox5.Text);
            emp[5] = Convert.ToDouble(textBox6.Text);
            emp[6] = Convert.ToDouble(textBox7.Text);
            emp[7] = Convert.ToDouble(textBox8.Text);
            emp[8] = Convert.ToDouble(textBox9.Text);
            emp[9] = Convert.ToDouble(textBox10.Text);



        }
        class Employee
        {
            //declaration
            int IDNum;
            double hourlyWage;
            //no argument constructor
            public Employee()
            {
            }
            //two argument cunstructor
            public Employee(int id, double hw)
            {
                try
                {
                    IDNum = id;
                    if (hw < 6 || hw > 50)//input validation
                        //throwing exception
                        throw new ArgumentException("Invalid Value", "hourlyWage");
                    else
                    {
                        Console.WriteLine("Employee Object Created Successfully");
                        hourlyWage = hw;
                    }
                }
                catch (ArgumentException ae)
                {
                    //handling exception
                    IDNum = 999;
                    hourlyWage = 6.0;
                    Console.WriteLine(ae.Message);
                }
            }
            //show data
            public void show()
            {

                Console.WriteLine(IDNum + "\t" + hourlyWage);
            }
        }
    }
}

Mark the other thread solved :)

Can you please explain what have you done so far and what is the problem you are facing now?

the same concept as te last question i need to create an array of 5 and to display id number and hourly pay rage i tried to create the array but i cant display the details

i did the code in console can you help me convert it to GUI

class Employee
    {
        //declaration
        int IDNum;
        double hourlyWage;
        //no argument constructor
        public Employee()
        {
        }
        //two argument cunstructor
        public Employee(int id, double hw)
        {
            try
            {
                IDNum = id;
                if (hw < 6 || hw > 50)//input validation
                    //throwing exception
                    throw new ArgumentException
("Invalid Value", "hourlyWage");
                else
                {
                    Console.WriteLine
("Employee Object Created Successfully");
                    hourlyWage = hw;
                }
            }
            catch (ArgumentException ae)
            {
                //handling exception
                IDNum = 999;
                hourlyWage = 6.0;
                Console.WriteLine(ae.Message);
            }
        }
        //show data
        public void show()
        {
            Console.WriteLine(IDNum + "\t" + hourlyWage);
        }
    }
//EmployeeExceptionDemo1 to create three objects to validate employee class
    class EmployeeExceptionDemo1
    {
        public static void Main(String[] args)
        {
            Console.WriteLine("Employee 1:");
            //below the range
            Employee emp1 = new Employee(1234, 5.0);
            Console.WriteLine("Employee 2:");
            //within the range
            Employee emp2 = new Employee(1235, 7.0);
            Console.WriteLine("Employee 3:");
            //above the range
            Employee emp3 = new Employee(1236, 51.0);
            Console.Read();
        }
    }
//EmployeeExceptionDemo2 to create three objects to validate //employee class by user input values
    class EmployeeExceptionDemo2
    {
        //main method
        public static void Main(String[] args)
        {
            //employee array with 5 values
            Employee[] emp = new Employee[5];
            int id;
            double wage;
            Console.WriteLine("Enter Employee Details");
            //reading data
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("Employee " + (i + 1));
                Console.Write("ID Number  :");
                id = Convert.ToInt32(Console.ReadLine());
                Console.Write("Hourly Wage:");
                wage = Convert.ToDouble(Console.ReadLine());
                emp[i] = new Employee(id, wage);
            }
            //display data
            Console.WriteLine("Display Employee Details");
            Console.WriteLine("IDNumber\tHourlyWage");
            for (int i = 0; i < 5; i++)
                emp[i].show();
            Console.Read();
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.