Link to home
Start Free TrialLog in
Avatar of davetough
davetough

asked on

change C# console app to windows form

not school work-
can i turn this console C# program into a program using a windows form?
if possible- any first ideas as to how to go about it?
program asks for salaries-
then sums them up with array and a for loop-
i have a more complicated program to convert- but do not understand how to have for loop and array in a gui form
thank you
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test1
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int i;
            int[] salary = new int[10];
            int sumofsalary = 0;
            
            for (i = 0;i <=4; i++)
            {
                Console.WriteLine("enter salary of Employee: {0}", i + 1);
                salary[i] = Int32.Parse(Console.ReadLine());
            }
            for (i = 0; i <= 4; i++)
            {
                sumofsalary = sumofsalary + salary[1];
            }
            Console.WriteLine("total salary given to employees is = " + sumofsalary);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
*You'd have to make a design-decision, supply ONE TextBox and track the number of entries with each Button click.
...or use multiple TextBoxes, one for each slot in the array.
...or use a DataGrid type control instead.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial