Tuesday, October 23, 2018

C# Displays Follow On for ExpenseIt Showing Use of Panels



This post will show my attempt at doing a navigation bar with the ExpenseIt non WPF (Windows Presentation Foundation) application example of Microsoft as I implemented using only one Windows Form and C# with the Microsoft Access database provided to avoid the need for canned data and panels rather than multiple forms.  (See the previous post “C# Displays Follow On for ExpenseIt Showing Version of Navigation Bar”.)

Using panels rather than multiple forms means that everything runs within the one Windows form class.  And mostly only the panel needs to be hidden or displayed rather than many different controls.

I used a separate panel for the arrow buttons at the top of the form and below it a set of different panels for the menu and the options that can be selected from the menu.  I named them the NavigationPanel, the MenuPanel, AddEmployeesPanel, UpdateEmployeesPanel, EnterExpensesPanel, and the DisplayExpensesPanel plus the ListPanel to select an employee to Update, or enter or display their expenses.

This drastically cut the amount of code while making it more difficult to design panels rather than forms.  That is, as panels were added, using the C# Toolbox to select controls into a particular panel got very difficult.  A particular panel couldn't be selected so the controls of various panels would all be displayed in the Form1.cs[Design] window intermixed with each other.

Starting out I had searched the internet and the answers all seemed to be that the controls would have to be created at runtime rather than via the C# Form1.cs[Design] window using the Toolbox.  I checked what I had done with the Display application of a number of years ago and found that I had done an interface class where I had used a Container control as the parent for the panel control.  I had used a Config(uration) class where I kept the structure of the various Containers with the various controls of the each container with their size, location, etc.  In each case the panel was the immediate child control of the Container control.  When the messages between the Display application and the Ada framework applications signaled that a change was necessary, a lookup was done to locate the new container in the configuration and its controls were created at runtime.  So I was doing what the internet search results suggested and what I should have remembered. 

But I didn't want to repeat this technique for the limited number of panels that were going to be necessary for the ExpenseIt application.  And I found that it wasn't necessary. 

One online response did suggest the use of "this.Controls.Add(thePanel)" while others replied on the same site that the panel controls would need to be added programmatically as I had previously done. Instead all that was necessary was to add a statement such as
      Controls.Add(AddEmployeesPanel);
to the button event handler that selects the panel.  Then the controls of the panel displayed after adding
      AddEmployeePanel.Visible = true;
That is, after the Form1.cs[Design] was used to select a panel into the window and changing the new panel's name to AddEmployeesPanel.









I had created the NavigationPanel and the MenuPanel first.  And then it got more complicated due to the controls getting mixed up with those of multiple panels showing all together.

In this case, after all done creating the panels, the Navigation Panel is at the top, the MenuPanel is displayed along with the final DisplayExpensesPanel and some of the controls of other panels with the Add button of the AddEmployee Panel visible and other text boxes, a portion of a label showing from behind the Menu Select button, etc.

After doing the MenuPanel and the panel to add an employee I gave it an initial try just to see what would happen when switching the panel to be displayed.  Upon the button click to display the panel to add an employee, the menu panel was hidden as expected but the AddEmployees Panel was blank.  That's when I found out about the
Controls.Add(AddEmployeesPanel);
command and the need to also use
AddEmployeesPanel.Visible = true;
This combination caused the newly selected panel to be displayed.

In adding the AddEmployeesPanel I found out that for some reason I had to move it down.  That is, the y location had to be lower than that of the Menu panel.  As I went along I also found that I needed to rename controls that were going to need to be referenced by the code, resize if necessary, and double click a button control, for instance, to get its event handler method added to Form1 while the panel was available in the [Design] window.  This was because it could be difficult to find the panel in the jumble to do it later.


For instance, when I finished I found that the Display Expenses panel had a small textbox in the middle of the Last Name textbox.  But I was unable to get the panel to display in the [Design] window to delete it.  However, I found that I could edit the Form1.Designer.cs file and locate a textbox within the code for the DisplayExpensesPanel that had its original name.  So I deleted that line of code and the panel then displayed correctly.  With this success I also adjusted the size and location of the panels to be similar making the display of the panels more consistent.


As I added panels I looked for ways that I could copy a Toolbar control into the correct panel.  At times I could move the newly created panel somewhat off to the side so that controls be would placed within it and then move the panel back.  Although this became more difficult to accomplish as more panels were added.  So at times, when executing the application to check on the looks of the panel, I would find that the control had been added to the wrong panel.  So I would have to delete it and try again.  I did find that at times a right click on a panel and selecting
Send To Back could be helpful as the desired panel might rise to the top.  And sometimes a list of panels would show up after the right click, but not all the panels would be listed.  Also Send To Back frequently didn't eventually bring the desired panel to the top.  So it was a learning experience. 

Selection of the Enter Expenses panel first displays the List Panel to allow the desired employee to be chosen.  Note: The title is changed on the List Panel depending upon the Menu Panel selection.  The Enter button does some validation of the entered data and then updates the Expenses Database.  An error will be displayed in the lower text box.

Selection of Display Expenses is similar in that the List Panel will be displayed first.  The ListPanel is used for ShowList or if the Enter Expenses or Display Expenses panels are selected.  The version shown is when Enter Expenses has been selected.  The Cancel button returns to the parent panel.

The illustrated UpdateEmployee panel is the initial view after the selection of John Bull from the employee list as displayed using the ShowList button.  This panel has some variations.  If Modify is clicked, these buttons will be hidden and a Department label and textbox will be displayed so that the employee's department can be changed.  An Update button and an error message text box will also appear to indicate that change is to be applied to the Employee Database while an error can appear if the employee is changed incorrectly or a text box is left blank.

In using Display Expenses it occurred to me that I could add a Next button in the same location as Enter button on the Enter Expenses panel to redisplay the List for the selection of another employee.  Currently, the operator has to return to the Menu and reselect Display Expenses.  However, I didn't want to mess up the panels so I left the panel unchanged.  It has occurred to me that in observing the structure of the compiler generated Form1.Designer.cs file that it might be possible to edit it to add such controls (taking care to first save the file in case it has to be restored).





Code Organization

The event handlers are all assigned to Form1.cs.  This somewhat works against object oriented since there really isn't a panel object.  That is, although there is panel in the [Design] Toolbox organized under a Containers heading, it doesn't carry over into C#.  Everything is directly a part of Form1.

So since all the controls are under the Windows Form rather than their particular panel I have grouped the button click event handlers and other methods within the Form1.cs file by the panel that should have been their container.

For the organization of the code I added a Navigation class to go with the previous SelectionQueue class and the new Form1 class.

The SelectionQueue class continues to keep track of which panels have been selected in the order of the original selection (except, of course, for the Navigation Panel).  This allows it to return whether a left or right arrow (or both) should be active depending upon whether the current panel is the last one queued, the first one queued, or in the middle.  Note: The displayed Menu Panel has had another panel chosen after it, such as the displayed Add Employees panel, so there is an active right arrow.

The Navigation class is also involved in the changing of the panels and the use of the arrow buttons.

The Form1 class is arranged in sections.  After the static variables and the constructor, comes the code associated with the Navigation Panel including the event handlers to forward the arrow clicks.  Then there is a structure that encapsulates data by the PanelSelection enumerated type.  For each enumerated panel the panel name is given, any parent or child panel and whether the panel is to be displayed before the child or parent.  As I got further along with the code I found that I didn't need displayFirst but left it in.  Then there is the SwitchPanels method that was placed here rather than in the Navigation class since it uses Form1 objects and the LoadEmployeeList method that is invoked from SwitchPanels.

Only a minimum number of lines of code are necessary to switch from one panel to another.  In some cases, such as Menu and Add Employee, only two lines of code are needed to add the panel control and make the panel visible (after the previous panel was hidden in the entry code).  This code was placed in the SwitchPanels method to avoid needing to do it twice – once if a button was clicked such as on the Menu Panel and once if an arrow button was clicked on the Navigation Panel.

Then, the event handlers are coded arranged according to their panel.  Each of these normally has only to invoke SelectPanel of the Navigation class.  Other times the panel isn't changed, such as AddEnteredEmployee_Click where textboxes have to be read, one of the databases accessed, a possible error message displayed, etc so all the code is within the event handler.


The Code

SelectionQueue.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace App
{

    public class SelectionQueue : ContainerControl
    {
        public struct ParentDataType
        {
            public Panel panel;
            public Form1.PanelSelection parent;
            public Form1.PanelSelection child;
            public bool displayFirst;
        }

        public struct QueueDataType // Queued topic messages
        {
            public Form1.PanelSelection selection;
        };

        public const int size = 10;

        private class QueueType
        {
            public bool unread;
            public int count;
            public int index;
            public QueueDataType[] data = new QueueDataType[size];
        };

        private QueueType queue = new QueueType();

        public SelectionQueue() // constructor
        {
            queue.unread = false;
            queue.count = 0;
            queue.index = -1;
        } // end constructor

        public Form1.PanelSelection Current()
        {
            return queue.data[queue.index].selection;

        } // end Current

        public Form1.PanelSelection Select(Form1.SelectionDirection direction)
        {
            Form1.PanelSelection selected;
            for (int p = 0; p < queue.count; p++)
            {
                Console.WriteLine("queue {0} {1}", p, queue.data[p].selection);
            }

            if (direction == Form1.SelectionDirection.LEFT)
            {
                if (queue.index < 1)
                {
                    queue.index = 0;
                    return Form1.PanelSelection.MENU;
                }
                queue.index--;
                selected = queue.data[queue.index].selection;
                return selected;
            }
            if (queue.index == (queue.count-1))
            {
                return queue.data[queue.index].selection;
            }
            queue.index++;
            selected = queue.data[queue.index].selection;
            return selected;
        } // end Select

        public bool NeedLeftArrow()
        {
            if (queue.index <= 0)
            { return false; }
            return true;
        } // end NeedLeftArrow

        public bool NeedRightArrow()
        {
            if (queue.index >= (queue.count - 1))
            { return false; }
            return true;
        } // end NeedRightArrow

        public bool Write(Form1.PanelSelection selection)
        {
            if (queue.count >= size)
            {
                return false;
            }
            if ((queue.count == 0) ||
                (selection != queue.data[queue.count - 1].selection))
            {
                bool matched = false;
                for (int p = 0; p < queue.count; p++)
                {
                    if (queue.data[p].selection == selection)
                    {
                        matched = true;
                        queue.index = p;
                        break; // exit loop
                    }
                }
                if (!matched)
                {
                    queue.data[queue.count].selection = selection;
                    queue.index = queue.count;
                    queue.count++;
                }
            }

            for (int p = 0; p < queue.count; p++)
            {
                Console.WriteLine("queue {0} {1}", p, queue.data[p].selection);
            }
            return true;
        } // end Write

    } // end class SelectionQueue
   
} // end namespace

Navigation.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace App
{

    public class SelectionQueue : ContainerControl
    {
        public struct ParentDataType
        {
            public Panel panel;
            public Form1.PanelSelection parent;
            public Form1.PanelSelection child;
            public bool displayFirst;
        }

        public struct QueueDataType // Queued topic messages
        {
            public Form1.PanelSelection selection;
        };

        public const int size = 10;

        private class QueueType
        {
            public bool unread;
            public int count;
            public int index;
            public QueueDataType[] data = new QueueDataType[size];
        };

        private QueueType queue = new QueueType();

        public SelectionQueue() // constructor
        {
            queue.unread = false;
            queue.count = 0;
            queue.index = -1;
        } // end constructor

        public Form1.PanelSelection Current()
        {
            return queue.data[queue.index].selection;

        } // end Current

        public Form1.PanelSelection Select(Form1.SelectionDirection direction)
        {
            Form1.PanelSelection selected;

            if (direction == Form1.SelectionDirection.LEFT)
            {
                if (queue.index < 1)
                {
                    queue.index = 0;
                    return Form1.PanelSelection.MENU;
                }
                queue.index--;
                selected = queue.data[queue.index].selection;
                return selected;
            }
            if (queue.index == (queue.count-1))
            {
                return queue.data[queue.index].selection;
            }
            queue.index++;
            selected = queue.data[queue.index].selection;
            return selected;
        } // end Select

        public bool NeedLeftArrow()
        {
            if (queue.index <= 0)
            { return false; }
            return true;
        } // end NeedLeftArrow

        public bool NeedRightArrow()
        {
            if (queue.index >= (queue.count - 1))
            { return false; }
            return true;
        } // end NeedRightArrow

        public bool Write(Form1.PanelSelection selection)
        {
            if (queue.count >= size)
            {
                return false;
            }
            if ((queue.count == 0) ||
                (selection != queue.data[queue.count - 1].selection))
            {
                bool matched = false;
                for (int p = 0; p < queue.count; p++)
                {
                    if (queue.data[p].selection == selection)
                    {
                        matched = true;
                        queue.index = p;
                        break; // exit loop
                    }
                }
                if (!matched)
                {
                    queue.data[queue.count].selection = selection;
                    queue.index = queue.count;
                    queue.count++;
                }
            }

            return true;
        } // end Write

    } // end class SelectionQueue
   
} // end namespace

Form1.cs

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 App
{
    public partial class Form1 : Form
    {
        private EmployeeDatabase employeeDatabase;
        private ExpensesDatabase expensesDatabase;

        private Navigation navigation;

        public enum PanelSelection
        {
            NONE,
            MENU,
            ADDEMPLOYEE,
            UPDATEEMPLOYEE,
            ENTEREXPENSES,
            DISPLAYEXPENSES,
            UPDATEEMPLOYEELIST,
            ENTEREXPENSESLIST,
            DISPLAYEXPENSESLIST
        }

        public SelectionQueue.ParentDataType[] parentData =
            new SelectionQueue.ParentDataType[SelectionQueue.size];

        public enum SelectionDirection
        {
            LEFT,
            RIGHT
        }

        // Employee selected from ListPanel
        private string listFirstName = "";
        private string listLastName = "";
        private string listDepartment = "";

        public Form1()
        {
            InitializeComponent();

            // Allow access to the databases
            employeeDatabase = new EmployeeDatabase(this);
            expensesDatabase = new ExpensesDatabase(this);

            // Activate the Navigation Panel
            navigation = new Navigation(this, this.leftArrow, this.rightArrow);

            // Select the Menu Panel as the first panel below the Navigation Panel
            navigation.SelectPanel(PanelSelection.MENU);

            // Build the structure of the panels
            SupplyPanelStructure();

        } // end constructor

        /**********************************************************************
         * Navigation panel actions
         */
        private void leftArrow_Click(object sender, EventArgs e)
        {
            navigation.ArrowClicked(SelectionDirection.LEFT);

        } // end leftArrow_Click

        private void rightArrow_Click(object sender, EventArgs e)
        {
            navigation.ArrowClicked(SelectionDirection.RIGHT);

        } // end rightArrow_Click

        private void SupplyPanelStructure()
        {
            parentData[(int)PanelSelection.NONE].panel = null;
            parentData[(int)PanelSelection.NONE].parent = PanelSelection.NONE;
            parentData[(int)PanelSelection.NONE].child = PanelSelection.NONE;
            parentData[(int)PanelSelection.NONE].displayFirst = true;
           
            parentData[(int)PanelSelection.MENU] =
                parentData[(int)PanelSelection.NONE];
            parentData[(int)PanelSelection.MENU].panel = MenuPanel;
           
            parentData[(int)PanelSelection.ADDEMPLOYEE] =
                parentData[(int)PanelSelection.NONE];
            parentData[(int)PanelSelection.ADDEMPLOYEE].panel = AddEmployeesPanel;
           
            parentData[(int)PanelSelection.UPDATEEMPLOYEE] =
                parentData[(int)PanelSelection.NONE];
            parentData[(int)PanelSelection.UPDATEEMPLOYEE].panel =
                UpdateEmployeesPanel;
            parentData[(int)PanelSelection.UPDATEEMPLOYEE].child =
                PanelSelection.UPDATEEMPLOYEELIST;
           
            parentData[(int)PanelSelection.ENTEREXPENSES].parent =
                PanelSelection.NONE;
            parentData[(int)PanelSelection.ENTEREXPENSES].panel = EnterExpensesPanel;
            parentData[(int)PanelSelection.ENTEREXPENSES].child =
                PanelSelection.ENTEREXPENSESLIST;
            parentData[(int)PanelSelection.ENTEREXPENSES].displayFirst = false;

            parentData[(int)PanelSelection.DISPLAYEXPENSES] =
                parentData[(int)PanelSelection.ENTEREXPENSES];
            parentData[(int)PanelSelection.DISPLAYEXPENSES].panel =
                DisplayExpensesPanel;
            parentData[(int)PanelSelection.DISPLAYEXPENSES].child =
                PanelSelection.DISPLAYEXPENSESLIST;

            parentData[(int)PanelSelection.UPDATEEMPLOYEELIST].panel = ListPanel;
            parentData[(int)PanelSelection.UPDATEEMPLOYEELIST].parent =
                PanelSelection.UPDATEEMPLOYEE;
            parentData[(int)PanelSelection.UPDATEEMPLOYEELIST].child =
                PanelSelection.NONE;
            parentData[(int)PanelSelection.UPDATEEMPLOYEELIST].displayFirst = false;
           
            parentData[(int)PanelSelection.ENTEREXPENSESLIST].panel = ListPanel;
            parentData[(int)PanelSelection.ENTEREXPENSESLIST].parent =
                PanelSelection.ENTEREXPENSES;
            parentData[(int)PanelSelection.ENTEREXPENSESLIST].child =
                PanelSelection.NONE;
            parentData[(int)PanelSelection.ENTEREXPENSESLIST].displayFirst = true;

            parentData[(int)PanelSelection.DISPLAYEXPENSESLIST].panel = ListPanel;
            parentData[(int)PanelSelection.DISPLAYEXPENSESLIST].parent =
                PanelSelection.DISPLAYEXPENSES;
            parentData[(int)PanelSelection.DISPLAYEXPENSESLIST].child =
                PanelSelection.NONE;
            parentData[(int)PanelSelection.DISPLAYEXPENSESLIST].displayFirst = true;
        } // end SupplyPanelStructure

        public void SwitchPanels(Form1.PanelSelection to)
        {
            MenuPanel.Visible = false;
            AddEmployeesPanel.Visible = false;
            UpdateEmployeesPanel.Visible = false;
            EnterExpensesPanel.Visible = false;
            DisplayExpensesPanel.Visible = false;
            ListPanel.Visible = false;

            // Note: Special initializations needed for particular panels are
            //       done here since that allows them to be done in one place.
            //       They are needed when there are modifications to a panel
            //       rather than have multiple versions of the panel.
            switch (to)
            {
                case PanelSelection.NONE:
                    {
                        break;
                    }
                case PanelSelection.MENU:
                    {
                        Controls.Add(MenuPanel);
                        MenuPanel.Visible = true;
                        break;
                    }
                case PanelSelection.ADDEMPLOYEE:
                    {
                        Controls.Add(AddEmployeesPanel);
                        AddEmployeesPanel.Visible = true;
                        break;
                    }
                case PanelSelection.UPDATEEMPLOYEE:
                    {
                        Controls.Add(UpdateEmployeesPanel);

                        // Modify visibility of selected panel controls
                        Modify.Visible = true;
                        Remove.Visible = true;
                        DepartmentLabel.Visible = false;
                        SelectDepartment.Visible = false;
                        UpdateButton.Visible = false;
                        ErrorMessage.Visible = false;
                        SelectErrorMessage.Visible = false; // because have an extra box

                        // Display ListPanel selected employee
                        if ((listFirstName != "") && (listLastName != ""))
                        {
                            SelectFirstName.Text = listFirstName;
                            SelectLastName.Text = listLastName;
                            SelectDepartment.Text = listDepartment;
                        }

                        // Make panel visible
                        UpdateEmployeesPanel.Visible = true;
                        break;
                    }
                case PanelSelection.UPDATEEMPLOYEELIST:
                    {
                        Controls.Add(ListPanel);
                        // Display the particular ListPanel title
                        ListPanelTitle.Text = "Update Employee";
                        ListPanel.Visible = true;

                        LoadEmployeeList();
                        break;
                    }
                case PanelSelection.ENTEREXPENSES:
                    {
                        Controls.Add(EnterExpensesPanel);
                        EnterExpensesPanel.Visible = true;

                        // Display ListPanel selected employee
                        if ((listFirstName != "") && (listLastName != ""))
                        {
                            EnterExpensesFirstName.Text = listFirstName;
                            EnterExpensesLastName.Text = listLastName;
                            EnterExpensesDepartment.Text = listDepartment;
                         }

                        break;
                    }
                case PanelSelection.ENTEREXPENSESLIST:
                    {
                        Controls.Add(ListPanel);
                        ListPanelTitle.Text = "Enter Expenses";
                        ListPanel.Visible = true;

                        LoadEmployeeList();
                        break;
                    }
                case PanelSelection.DISPLAYEXPENSES:
                    {
                        Controls.Add(DisplayExpensesPanel);
                        DisplayExpensesPanel.Visible = true;

                        // Display ListPanel selected employee
                        if ((listFirstName != "") && (listLastName != ""))
                        {
                            DisplayExpensesFirstName.Text = listFirstName;
                            DisplayExpensesLastName.Text = listLastName;
                            DisplayExpensesDepartment.Text = listDepartment;
                        }

                        DescListBox.Items.Clear();
                        DateListBox.Items.Clear();
                        AmtListBox.Items.Clear();

                        // Obtain employee's expenses
                        ExpensesDatabase.ExpensesListType expenses =
                            new ExpensesDatabase.ExpensesListType();
                        expenses = ExpensesDatabase.ExpensesList
                                   (listFirstName, listLastName);

                        // Display employee's expenses
                        string description, date, amount;
                        string datetime;
                        for (int i = 0; i < expenses.count; i++)
                        {
                            description = expenses.list[i].description;
                            DescListBox.Items.Add(description);
                            datetime = expenses.list[i].date;
                            int ii = datetime.IndexOf(' '); // find " 12:00:00 AM"
                            if (ii > 0)
                            {
                                date = datetime.Substring(0, ii);
                            }
                            else
                            {
                                date = datetime;
                            }
                            DateListBox.Items.Add(date);
                            amount = expenses.list[i].amount;
                            AmtListBox.Items.Add(amount);
                        }
                        DescListBox.Height = DescListBox.PreferredHeight;
                        DateListBox.Height = DateListBox.PreferredHeight;
                        AmtListBox.Height = AmtListBox.PreferredHeight;

                        break;
                    }
                case PanelSelection.DISPLAYEXPENSESLIST:
                    {
                        Controls.Add(ListPanel);
                        ListPanelTitle.Text = "Display Expenses";
                        ListPanel.Visible = true;


                        LoadEmployeeList();

                        break;
                    }
            } // end switch
        } // end SwitchPanels

        // Common method for UpdateEmployee, EnterExpenses, and UpdateExpenses
        private void LoadEmployeeList()
        {
            // Clear the list box
            employeeList.Items.Clear();

            // Obtain the list of employees
            EmployeeDatabase.EmployeeListType employees =
                new EmployeeDatabase.EmployeeListType();
            employees = EmployeeDatabase.EmployeeList();

            // Transfer to the list box
            for (int i = 0; i < employees.count; i++)
            {
                employeeList.Items.Add(employees.list[i].lastName + "\t" +
                                       employees.list[i].firstName + "\t" +
                                       employees.list[i].department);
            }
            // Display the list box
            employeeList.Visible = true;   

        } // end LoadEmployeeList

        /**********************************************************************
         * Menu panel actions
         */
        private void AddEmployee_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.ADDEMPLOYEE);
        } // AddEmployee_Click

        private void UpdateEmployee_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.UPDATEEMPLOYEE);
        } // end UpdateEmployee_Click

        private void Expenses_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.ENTEREXPENSESLIST);
        } // end Expenses_Click

        // Note: Due to problems getting the panels laid out using
        //       Form1.cs[Design], when I went to use the Display_Click
        //       I was prevented from doing so although I don't see an
        //       entry for it in Form1.Designer.cs as it became finalized.
        private void Display_Click_1(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.DISPLAYEXPENSESLIST);
        }

        /**********************************************************************
         * AddEmployees panel actions
         */
        private void AddEnteredEmployee_Click(object sender, EventArgs e)
        {
            // Clear any error message
            ErrorMessageBox.Clear();
            // Obtain entered data
            string firstName, lastName, department;
            firstName = FirstName.Text;
            lastName = LastName.Text;
            department = Department.Text;

            // Check that values supplied
            if ((firstName == "") || (lastName == "") || (department == ""))
            {
                ErrorMessageBox.Text = "Error: all fields must be supplied";
                return;
            }

            // Update database
            string response = EmployeeDatabase.AddEmployee
                              (firstName, lastName, department);

            if (response == "success")
            {
                FirstName.Clear();
                LastName.Clear();
                Department.Clear();
            }
            else
            {
                ErrorMessageBox.Text = response;
            }
        } // end AddEnteredEmployee_Click

        /**********************************************************************
         * UpdateEmployees panel actions
         */
        private void ShowList_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.UPDATEEMPLOYEELIST);
        } // end ShowList_Click

        private void UpdateButton_Click(object sender, EventArgs e)
        {
            // Clear any error message
            ErrorMessage.Clear();

            // Obtain entered data
            string firstName, lastName, department;
            firstName = SelectFirstName.Text;
            lastName = SelectLastName.Text;
            department = SelectDepartment.Text;

            // Check that values supplied
            if ((firstName == "") || (lastName == "") || (department == ""))
            {
                ErrorMessage.Text = "Error: all fields must be supplied";
                ErrorMessage.Show();
                return;
            }

            // Update database
            string response = EmployeeDatabase.ModifyEmployeeData
                              (firstName, lastName, department);

            if (response == "success")
            {
                ErrorMessage.Clear();
                ErrorMessage.Hide();
                SelectFirstName.Clear();
                SelectLastName.Clear();
                DepartmentLabel.Hide();
                SelectDepartment.Clear();
                SelectDepartment.Hide();
                UpdateButton.Hide();
                Modify.Show();
                Remove.Show();
            }
            else
            {
                ErrorMessage.Text = response;
                ErrorMessage.Show();
            }
        } // end UpdateButton_Click

        private void Remove_Click(object sender, EventArgs e)
        {
            // Clear any error message
            ErrorMessage.Clear();
            ErrorMessage.Hide();

            DepartmentLabel.Hide();
            Department.Hide();

            // Obtain entered data
            string firstName, lastName;
            firstName = FirstName.Text;
            lastName = LastName.Text;

            // Check that values supplied
            if ((firstName == "") || (lastName == ""))
            {
                ErrorMessage.Text = "Error: all fields must be supplied";
                ErrorMessage.Show();
                return;
            }

            // Update database
            string response = EmployeeDatabase.RemoveEmployee
                              (firstName, lastName);

            if (response == "success")
            {
                FirstName.Clear();
                LastName.Clear();
                ErrorMessage.Hide();
            }
            else
            {
                ErrorMessage.Text = response;
                ErrorMessage.Show();
            }
        } // end Remove_Click

        private void Modify_Click(object sender, EventArgs e)
        {
            Modify.Visible = false;
            Remove.Visible = false;
            DepartmentLabel.Visible = true;
            SelectDepartment.Visible = true;
            UpdateButton.Visible = true;

        } // end Modify_Click

        /**********************************************************************
         * EnterExpenses panel actions
         */
        private void EnterExpensesButton_Click(object sender, EventArgs e)
        {
            // Capture data
            string firstName = EnterExpensesFirstName.Text;
            string lastName = EnterExpensesLastName.Text;
            string department = EnterExpensesDepartment.Text;
            string description = EnterExpensesDescription.Text;
            string amount = EnterExpensesAmount.Text;
            string date = EnterExpensesDate.Text;

            // Check that values supplied
            if ((firstName == "") || (lastName == "") || (department == "") ||
                (description == "") || (amount == "") || (date == ""))
            {
                ErrorExpensesErrorMessage.Text = "Error: all fields must be supplied";
                ErrorExpensesErrorMessage.Show();
                return;
            }
            // Check that amount is decimal and date is formatted correctly
            Decimal amt;
            bool canConvert = decimal.TryParse(amount, out amt);
            if (!canConvert)
            {
                ErrorExpensesErrorMessage.Text = "Error: Amount must be xx.xx format";
                ErrorExpensesErrorMessage.Show();
                return;
            }
            DateTime d;
            canConvert = DateTime.TryParse(date, out d);
            if (!canConvert)
            {
                ErrorExpensesErrorMessage.Text = "Error: Date must be mm/dd/yy format";
                ErrorExpensesErrorMessage.Show();
                return;
            }

            // Add expense to database
            string response =
                ExpensesDatabase.AddExpense(firstName, lastName, description, amt, d);
            if (response == "success")
            {
                ErrorExpensesErrorMessage.Hide();
                EnterExpensesDescription.Clear();
                EnterExpensesAmount.Clear();
                EnterExpensesDate.Clear();
            }
            else
            {
                ErrorExpensesErrorMessage.Text = response;
                ErrorExpensesErrorMessage.Show();
            }

        } // end EnterExpensesButton_Click

        private void EnterExpensesDone_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.MENU);
        } // end EnterExpensesDone_Click

        /**********************************************************************
         * DisplayExpenses panel actions
         */
        private void DisplayExpensesDone_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(PanelSelection.MENU);
        } // end DisplayExpensesDone_Click

        /**********************************************************************
         * List panel actions
         */
        private void CancelEmployeeList_Click(object sender, EventArgs e)
        {
            navigation.SelectPanel(navigation.SelectParentPanel());
        } // end CancelEmployeeList_Click

        private void employeeList_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Clear the employee identification that is to be used by the
            // parent panel
            listFirstName = "";
            listLastName = "";
            listDepartment = "";

            // Get currently selected entry
            string curItem = employeeList.SelectedItem.ToString();
            int index = employeeList.FindString(curItem);

            // If the item was not found in employeeList display a message box,
            // otherwise select it in employeeList.
            if (index == -1)
                MessageBox.Show("Error: Item is not available in employee list");
            else
            {
                int i = curItem.IndexOf('\t');
                if (i > 0)
                {
                    listLastName = curItem.Substring(0, i);
                    int l = curItem.Length - i - 1;
                    string restOf = curItem.Substring(i + 1, l);
                    i = restOf.IndexOf('\t');
                    if (i > 0)
                    {
                        listFirstName = restOf.Substring(0, i);
                        l = restOf.Length - i - 1;
                        listDepartment = restOf.Substring(i + 1, l);
                    }
                }

                // Select the parent panel to use the selected employee.
                navigation.SelectPanel(navigation.SelectParentPanel());
            }
        } // end employeeList_SelectedIndexChanged

    } // end class Form1
} // end namespace


Form1.Designer.cs

This code was generated by the compiler but was modified by hand after the panels were completed via the use of Form1.cs[Design] to remove an unwanted textbox and to make the panels be more uniformly located and sized.

namespace App
{
    partial class Form1
    {
        /// <summary>
        ///
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.NavigationPanel = new System.Windows.Forms.Panel();
            this.rightArrow = new System.Windows.Forms.Button();
            this.leftArrow = new System.Windows.Forms.Button();
            this.MenuPanel = new System.Windows.Forms.Panel();
            this.Display = new System.Windows.Forms.Button();
            this.Expenses = new System.Windows.Forms.Button();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.UpdateEmployee = new System.Windows.Forms.Button();
            this.AddEmployee = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.AddEmployeesPanel = new System.Windows.Forms.Panel();
            this.ErrorMessageBox = new System.Windows.Forms.TextBox();
            this.AddEnteredEmployee = new System.Windows.Forms.Button();
            this.Department = new System.Windows.Forms.TextBox();
            this.LastName = new System.Windows.Forms.TextBox();
            this.FirstName = new System.Windows.Forms.TextBox();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.ListPanel = new System.Windows.Forms.Panel();
            this.DisplayExpensesPanel = new System.Windows.Forms.Panel();
            this.DisplayExpensesDone = new System.Windows.Forms.Button();
            this.AmtListBox = new System.Windows.Forms.ListBox();
            this.label21 = new System.Windows.Forms.Label();
            this.label19 = new System.Windows.Forms.Label();
            this.DisplayExpensesDepartment = new System.Windows.Forms.TextBox();
            this.DateListBox = new System.Windows.Forms.ListBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.DisplayExpensesLastName = new System.Windows.Forms.TextBox();
            this.label17 = new System.Windows.Forms.Label();
            this.DescListBox = new System.Windows.Forms.ListBox();
            this.label18 = new System.Windows.Forms.Label();
            this.DisplayExpensesFirstName = new System.Windows.Forms.TextBox();
            this.ListPanelTitle = new System.Windows.Forms.Label();
            this.employeeList = new System.Windows.Forms.ListBox();
            this.label15 = new System.Windows.Forms.Label();
            this.EnterExpensesPanel = new System.Windows.Forms.Panel();
            this.ErrorExpensesErrorMessage = new System.Windows.Forms.TextBox();
            this.EnterExpensesDone = new System.Windows.Forms.Button();
            this.EnterExpensesButton = new System.Windows.Forms.Button();
            this.EnterExpensesDate = new System.Windows.Forms.TextBox();
            this.EnterExpensesAmount = new System.Windows.Forms.TextBox();
            this.EnterExpensesDescription = new System.Windows.Forms.TextBox();
            this.label16 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.EnterExpensesDepartment = new System.Windows.Forms.TextBox();
            this.EnterExpensesLastName = new System.Windows.Forms.TextBox();
            this.EnterExpensesFirstName = new System.Windows.Forms.TextBox();
            this.EnterExpensesTitle = new System.Windows.Forms.Label();
            this.CancelEmployeeList = new System.Windows.Forms.Button();
            this.label7 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.UpdateEmployeesPanel = new System.Windows.Forms.Panel();
            this.ErrorMessage = new System.Windows.Forms.TextBox();
            this.SelectErrorMessage = new System.Windows.Forms.TextBox();
            this.UpdateButton = new System.Windows.Forms.Button();
            this.Remove = new System.Windows.Forms.Button();
            this.Modify = new System.Windows.Forms.Button();
            this.SelectDepartment = new System.Windows.Forms.TextBox();
            this.DepartmentLabel = new System.Windows.Forms.Label();
            this.SelectLastName = new System.Windows.Forms.TextBox();
            this.SelectFirstName = new System.Windows.Forms.TextBox();
            this.label13 = new System.Windows.Forms.Label();
            this.UpdateEmployeeTitle = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.ShowList = new System.Windows.Forms.Button();
            this.DisplayExpensesDescription = new System.Windows.Forms.TextBox();
            this.NavigationPanel.SuspendLayout();
            this.MenuPanel.SuspendLayout();
            this.AddEmployeesPanel.SuspendLayout();
            this.ListPanel.SuspendLayout();
            this.DisplayExpensesPanel.SuspendLayout();
            this.EnterExpensesPanel.SuspendLayout();
            this.UpdateEmployeesPanel.SuspendLayout();
            this.SuspendLayout();
            //
            // NavigationPanel
            //
            this.NavigationPanel.Controls.Add(this.rightArrow);
            this.NavigationPanel.Controls.Add(this.leftArrow);
            this.NavigationPanel.Location = new System.Drawing.Point(0, 0);
            this.NavigationPanel.Name = "NavigationPanel";
            this.NavigationPanel.Size = new System.Drawing.Size(488, 45);
            this.NavigationPanel.TabIndex = 0;
            //
            // rightArrow
            //
            this.rightArrow.Location = new System.Drawing.Point(42, 8);
            this.rightArrow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.rightArrow.Name = "rightArrow";
            this.rightArrow.Size = new System.Drawing.Size(33, 33);
            this.rightArrow.TabIndex = 2;
            this.rightArrow.UseVisualStyleBackColor = true;
            this.rightArrow.Click += new System.EventHandler(this.rightArrow_Click);
            //
            // leftArrow
            //
            this.leftArrow.Location = new System.Drawing.Point(3, 8);
            this.leftArrow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.leftArrow.Name = "leftArrow";
            this.leftArrow.Size = new System.Drawing.Size(33, 33);
            this.leftArrow.TabIndex = 1;
            this.leftArrow.UseVisualStyleBackColor = true;
            this.leftArrow.Click += new System.EventHandler(this.leftArrow_Click);
            //
            // MenuPanel
            //
            this.MenuPanel.Controls.Add(this.Display);
            this.MenuPanel.Controls.Add(this.Expenses);
            this.MenuPanel.Controls.Add(this.label5);
            this.MenuPanel.Controls.Add(this.label4);
            this.MenuPanel.Controls.Add(this.UpdateEmployee);
            this.MenuPanel.Controls.Add(this.AddEmployee);
            this.MenuPanel.Controls.Add(this.label1);
            this.MenuPanel.Controls.Add(this.label2);
            this.MenuPanel.Controls.Add(this.label3);
            this.MenuPanel.Controls.Add(this.AddEmployeesPanel);
            this.MenuPanel.Controls.Add(this.UpdateEmployeesPanel);
            this.MenuPanel.Location = new System.Drawing.Point(0, 46);
            this.MenuPanel.Name = "MenuPanel";
            this.MenuPanel.Size = new System.Drawing.Size(488, 390);
            this.MenuPanel.TabIndex = 1;
            //
            // Display
            //
            this.Display.Location = new System.Drawing.Point(239, 203);
            this.Display.Name = "Display";
            this.Display.Size = new System.Drawing.Size(75, 23);
            this.Display.TabIndex = 14;
            this.Display.Text = "Display";
            this.Display.UseVisualStyleBackColor = true;
            this.Display.Click += new System.EventHandler(this.Display_Click_1);
            //
            // Expenses
            //
            this.Expenses.Location = new System.Drawing.Point(239, 164);
            this.Expenses.Name = "Expenses";
            this.Expenses.Size = new System.Drawing.Size(75, 23);
            this.Expenses.TabIndex = 11;
            this.Expenses.Text = "Enter";
            this.Expenses.UseVisualStyleBackColor = true;
            this.Expenses.Click += new System.EventHandler(this.Expenses_Click);
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(14, 203);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(119, 17);
            this.label5.TabIndex = 10;
            this.label5.Text = "Display Expenses";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(13, 164);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(107, 17);
            this.label4.TabIndex = 9;
            this.label4.Text = "Enter Expenses";
            //
            // UpdateEmployee
            //
            this.UpdateEmployee.Location = new System.Drawing.Point(241, 101);
            this.UpdateEmployee.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.UpdateEmployee.Name = "UpdateEmployee";
            this.UpdateEmployee.Size = new System.Drawing.Size(73, 23);
            this.UpdateEmployee.TabIndex = 8;
            this.UpdateEmployee.Text = "Select";
            this.UpdateEmployee.UseVisualStyleBackColor = true;
            this.UpdateEmployee.Click += new System.EventHandler(this.UpdateEmployee_Click);
            //
            // AddEmployee
            //
            this.AddEmployee.Location = new System.Drawing.Point(241, 60);
            this.AddEmployee.Margin = new System.Windows.Forms.Padding(4);
            this.AddEmployee.Name = "AddEmployee";
            this.AddEmployee.Size = new System.Drawing.Size(73, 23);
            this.AddEmployee.TabIndex = 6;
            this.AddEmployee.Text = "Add";
            this.AddEmployee.UseVisualStyleBackColor = true;
            this.AddEmployee.Click += new System.EventHandler(this.AddEmployee_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(214, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(62, 25);
            this.label1.TabIndex = 5;
            this.label1.Text = "Menu";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(13, 60);
            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(99, 17);
            this.label2.TabIndex = 4;
            this.label2.Text = "Add Employee";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(13, 101);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(120, 17);
            this.label3.TabIndex = 7;
            this.label3.Text = "Update Employee";
            //
            // AddEmployeesPanel
            //
            this.AddEmployeesPanel.Controls.Add(this.ErrorMessageBox);
            this.AddEmployeesPanel.Controls.Add(this.AddEnteredEmployee);
            this.AddEmployeesPanel.Controls.Add(this.Department);
            this.AddEmployeesPanel.Controls.Add(this.LastName);
            this.AddEmployeesPanel.Controls.Add(this.FirstName);
            this.AddEmployeesPanel.Controls.Add(this.label10);
            this.AddEmployeesPanel.Controls.Add(this.label9);
            this.AddEmployeesPanel.Controls.Add(this.label8);
            this.AddEmployeesPanel.Controls.Add(this.ListPanel);
            this.AddEmployeesPanel.Controls.Add(this.label7);
            this.AddEmployeesPanel.Controls.Add(this.label11);
            this.AddEmployeesPanel.Location = new System.Drawing.Point(3, 20);
            this.AddEmployeesPanel.Name = "AddEmployeesPanel";
            this.AddEmployeesPanel.Size = new System.Drawing.Size(488, 447);
            this.AddEmployeesPanel.TabIndex = 13;
            //
            // ErrorMessageBox
            //
            this.ErrorMessageBox.Location = new System.Drawing.Point(31, 356);
            this.ErrorMessageBox.Name = "ErrorMessageBox";
            this.ErrorMessageBox.Size = new System.Drawing.Size(444, 22);
            this.ErrorMessageBox.TabIndex = 9;
            //
            // AddEnteredEmployee
            //
            this.AddEnteredEmployee.Location = new System.Drawing.Point(31, 251);
            this.AddEnteredEmployee.Name = "AddEnteredEmployee";
            this.AddEnteredEmployee.Size = new System.Drawing.Size(75, 23);
            this.AddEnteredEmployee.TabIndex = 8;
            this.AddEnteredEmployee.Text = "Add";
            this.AddEnteredEmployee.UseVisualStyleBackColor = true;
            this.AddEnteredEmployee.Click += new System.EventHandler(this.AddEnteredEmployee_Click);
            //
            // Department
            //
            this.Department.Location = new System.Drawing.Point(126, 183);
            this.Department.Name = "Department";
            this.Department.Size = new System.Drawing.Size(155, 22);
            this.Department.TabIndex = 7;
            //
            // LastName
            //
            this.LastName.Location = new System.Drawing.Point(297, 126);
            this.LastName.Name = "LastName";
            this.LastName.Size = new System.Drawing.Size(178, 22);
            this.LastName.TabIndex = 6;
            //
            // FirstName
            //
            this.FirstName.Location = new System.Drawing.Point(126, 126);
            this.FirstName.Name = "FirstName";
            this.FirstName.Size = new System.Drawing.Size(155, 22);
            this.FirstName.TabIndex = 5;
            //
            // label10
            //
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(31, 186);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(82, 17);
            this.label10.TabIndex = 4;
            this.label10.Text = "Department";
            //
            // label9
            //
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(31, 131);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(45, 17);
            this.label9.TabIndex = 3;
            this.label9.Text = "Name";
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(294, 87);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(35, 17);
            this.label8.TabIndex = 2;
            this.label8.Text = "Last";
            //
            // ListPanel
            //
            this.ListPanel.Controls.Add(this.DisplayExpensesPanel);
            this.ListPanel.Controls.Add(this.ListPanelTitle);
            this.ListPanel.Controls.Add(this.employeeList);
            this.ListPanel.Controls.Add(this.label15);
            this.ListPanel.Controls.Add(this.EnterExpensesPanel);
            this.ListPanel.Controls.Add(this.CancelEmployeeList);
            this.ListPanel.Location = new System.Drawing.Point(0, 13);
            this.ListPanel.Name = "ListPanel";
            this.ListPanel.Size = new System.Drawing.Size(488, 690);
            this.ListPanel.TabIndex = 16;
            //
            // DisplayExpensesPanel
            //
            this.DisplayExpensesPanel.Controls.Add(this.DisplayExpensesDone);
            this.DisplayExpensesPanel.Controls.Add(this.AmtListBox);
            this.DisplayExpensesPanel.Controls.Add(this.label21);
            this.DisplayExpensesPanel.Controls.Add(this.label19);
            this.DisplayExpensesPanel.Controls.Add(this.DisplayExpensesDepartment);
            this.DisplayExpensesPanel.Controls.Add(this.DateListBox);
            this.DisplayExpensesPanel.Controls.Add(this.DisplayExpensesLastName);
            this.DisplayExpensesPanel.Controls.Add(this.label17);
            this.DisplayExpensesPanel.Controls.Add(this.DescListBox);
            this.DisplayExpensesPanel.Controls.Add(this.label18);
            this.DisplayExpensesPanel.Controls.Add(this.DisplayExpensesFirstName);
            this.DisplayExpensesPanel.Location = new System.Drawing.Point(0, 3);
            this.DisplayExpensesPanel.Name = "DisplayExpensesPanel";
            this.DisplayExpensesPanel.Size = new System.Drawing.Size(488, 447);
            this.DisplayExpensesPanel.TabIndex = 17;
            //
            // DisplayExpensesDone
            //
            this.DisplayExpensesDone.Location = new System.Drawing.Point(390, 355);
            this.DisplayExpensesDone.Name = "DisplayExpensesDone";
            this.DisplayExpensesDone.Size = new System.Drawing.Size(75, 23);
            this.DisplayExpensesDone.TabIndex = 32;
            this.DisplayExpensesDone.Text = "Done";
            this.DisplayExpensesDone.UseVisualStyleBackColor = true;
            this.DisplayExpensesDone.Click += new System.EventHandler(this.DisplayExpensesDone_Click);
            //
            // AmtListBox
            //
            this.AmtListBox.FormattingEnabled = true;
            this.AmtListBox.ItemHeight = 16;
            this.AmtListBox.Location = new System.Drawing.Point(342, 197);
            this.AmtListBox.Name = "AmtListBox";
            this.AmtListBox.Size = new System.Drawing.Size(120, 148);
            this.AmtListBox.TabIndex = 31;
            //
            // label21
            //
            this.label21.AutoSize = true;
            this.label21.Location = new System.Drawing.Point(342, 170);
            this.label21.Name = "label21";
            this.label21.Size = new System.Drawing.Size(56, 17);
            this.label21.TabIndex = 30;
            this.label21.Text = "Amount";
            //
            // label19
            //
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(216, 170);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(38, 17);
            this.label19.TabIndex = 28;
            this.label19.Text = "Date";
            //
            // DisplayExpensesDepartment
            //
            this.DisplayExpensesDepartment.Location = new System.Drawing.Point(36, 124);
            this.DisplayExpensesDepartment.Name = "DisplayExpensesDepartment";
            this.DisplayExpensesDepartment.Size = new System.Drawing.Size(159, 22);
            this.DisplayExpensesDepartment.TabIndex = 27;
            //
            // DateListBox
            //
            this.DateListBox.FormattingEnabled = true;
            this.DateListBox.ItemHeight = 16;
            this.DateListBox.Location = new System.Drawing.Point(216, 197);
            this.DateListBox.Name = "DateListBox";
            this.DateListBox.Size = new System.Drawing.Size(120, 148);
            this.DateListBox.TabIndex = 25;
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(252, 78);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(100, 22);
            this.textBox1.TabIndex = 24;
            //
            // DisplayExpensesLastName
            //
            this.DisplayExpensesLastName.Location = new System.Drawing.Point(216, 78);
            this.DisplayExpensesLastName.Name = "DisplayExpensesLastName";
            this.DisplayExpensesLastName.Size = new System.Drawing.Size(171, 22);
            this.DisplayExpensesLastName.TabIndex = 23;
            //
            // label17
            //
            this.label17.AutoSize = true;
            this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label17.Location = new System.Drawing.Point(200, 37);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(168, 25);
            this.label17.TabIndex = 22;
            this.label17.Text = "Display Expenses";
            //
            // DescListBox
            //
            this.DescListBox.FormattingEnabled = true;
            this.DescListBox.ItemHeight = 16;
            this.DescListBox.Location = new System.Drawing.Point(39, 197);
            this.DescListBox.Name = "DescListBox";
            this.DescListBox.Size = new System.Drawing.Size(168, 148);
            this.DescListBox.TabIndex = 21;
            //
            // label18
            //
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(36, 170);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(79, 17);
            this.label18.TabIndex = 20;
            this.label18.Text = "Description";
            //
            // DisplayExpensesFirstName
            //
            this.DisplayExpensesFirstName.Location = new System.Drawing.Point(36, 78);
            this.DisplayExpensesFirstName.Name = "DisplayExpensesFirstName";
            this.DisplayExpensesFirstName.Size = new System.Drawing.Size(160, 22);
            this.DisplayExpensesFirstName.TabIndex = 18;
            //
            // ListPanelTitle
            //
            this.ListPanelTitle.AutoSize = true;
            this.ListPanelTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ListPanelTitle.Location = new System.Drawing.Point(169, 28);
            this.ListPanelTitle.Name = "ListPanelTitle";
            this.ListPanelTitle.Size = new System.Drawing.Size(41, 25);
            this.ListPanelTitle.TabIndex = 18;
            this.ListPanelTitle.Text = "title";
            //
            // employeeList
            //
            this.employeeList.FormattingEnabled = true;
            this.employeeList.ItemHeight = 16;
            this.employeeList.Location = new System.Drawing.Point(3, 84);
            this.employeeList.Name = "employeeList";
            this.employeeList.Size = new System.Drawing.Size(479, 292);
            this.employeeList.Sorted = true;
            this.employeeList.TabIndex = 17;
            this.employeeList.Visible = false;
            this.employeeList.SelectedIndexChanged += new System.EventHandler(this.employeeList_SelectedIndexChanged);
            //
            // label15
            //
            this.label15.AutoSize = true;
            this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label15.Location = new System.Drawing.Point(164, 28);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(0, 25);
            this.label15.TabIndex = 16;
            //
            // EnterExpensesPanel
            //
            this.EnterExpensesPanel.Controls.Add(this.ErrorExpensesErrorMessage);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesDone);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesButton);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesDate);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesAmount);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesDescription);
            this.EnterExpensesPanel.Controls.Add(this.label16);
            this.EnterExpensesPanel.Controls.Add(this.label14);
            this.EnterExpensesPanel.Controls.Add(this.label6);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesDepartment);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesLastName);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesFirstName);
            this.EnterExpensesPanel.Controls.Add(this.EnterExpensesTitle);
            this.EnterExpensesPanel.Location = new System.Drawing.Point(3, 28);
            this.EnterExpensesPanel.Name = "EnterExpensesPanel";
            this.EnterExpensesPanel.Size = new System.Drawing.Size(488, 370);
            this.EnterExpensesPanel.TabIndex = 17;
            //
            // ErrorExpensesErrorMessage
            //
            this.ErrorExpensesErrorMessage.Location = new System.Drawing.Point(19, 325);
            this.ErrorExpensesErrorMessage.Name = "ErrorExpensesErrorMessage";
            this.ErrorExpensesErrorMessage.Size = new System.Drawing.Size(445, 22);
            this.ErrorExpensesErrorMessage.TabIndex = 12;
            //
            // EnterExpensesDone
            //
            this.EnterExpensesDone.Location = new System.Drawing.Point(362, 281);
            this.EnterExpensesDone.Name = "EnterExpensesDone";
            this.EnterExpensesDone.Size = new System.Drawing.Size(75, 23);
            this.EnterExpensesDone.TabIndex = 11;
            this.EnterExpensesDone.Text = "Done";
            this.EnterExpensesDone.UseVisualStyleBackColor = true;
            this.EnterExpensesDone.Click += new System.EventHandler(this.EnterExpensesDone_Click);
            //
            // EnterExpensesButton
            //
            this.EnterExpensesButton.Location = new System.Drawing.Point(51, 281);
            this.EnterExpensesButton.Name = "EnterExpensesButton";
            this.EnterExpensesButton.Size = new System.Drawing.Size(75, 23);
            this.EnterExpensesButton.TabIndex = 10;
            this.EnterExpensesButton.Text = "Enter";
            this.EnterExpensesButton.UseVisualStyleBackColor = true;
            this.EnterExpensesButton.Click += new System.EventHandler(this.EnterExpensesButton_Click);
            //
            // EnterExpensesDate
            //
            this.EnterExpensesDate.Location = new System.Drawing.Point(145, 226);
            this.EnterExpensesDate.Name = "EnterExpensesDate";
            this.EnterExpensesDate.Size = new System.Drawing.Size(100, 22);
            this.EnterExpensesDate.TabIndex = 9;
            //
            // EnterExpensesAmount
            //
            this.EnterExpensesAmount.Location = new System.Drawing.Point(145, 190);
            this.EnterExpensesAmount.Name = "EnterExpensesAmount";
            this.EnterExpensesAmount.Size = new System.Drawing.Size(100, 22);
            this.EnterExpensesAmount.TabIndex = 8;
            //
            // EnterExpensesDescription
            //
            this.EnterExpensesDescription.Location = new System.Drawing.Point(145, 155);
            this.EnterExpensesDescription.Name = "EnterExpensesDescription";
            this.EnterExpensesDescription.Size = new System.Drawing.Size(191, 22);
            this.EnterExpensesDescription.TabIndex = 7;
            //
            // label16
            //
            this.label16.AutoSize = true;
            this.label16.Location = new System.Drawing.Point(51, 229);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(38, 17);
            this.label16.TabIndex = 6;
            this.label16.Text = "Date";
            //
            // label14
            //
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(51, 190);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(56, 17);
            this.label14.TabIndex = 5;
            this.label14.Text = "Amount";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(51, 155);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(79, 17);
            this.label6.TabIndex = 4;
            this.label6.Text = "Description";
            //
            // EnterExpensesDepartment
            //
            this.EnterExpensesDepartment.Location = new System.Drawing.Point(51, 110);
            this.EnterExpensesDepartment.Name = "EnterExpensesDepartment";
            this.EnterExpensesDepartment.Size = new System.Drawing.Size(147, 22);
            this.EnterExpensesDepartment.TabIndex = 3;
            //
            // EnterExpensesLastName
            //
            this.EnterExpensesLastName.Location = new System.Drawing.Point(222, 70);
            this.EnterExpensesLastName.Name = "EnterExpensesLastName";
            this.EnterExpensesLastName.Size = new System.Drawing.Size(147, 22);
            this.EnterExpensesLastName.TabIndex = 2;
            //
            // EnterExpensesFirstName
            //
            this.EnterExpensesFirstName.Location = new System.Drawing.Point(51, 70);
            this.EnterExpensesFirstName.Name = "EnterExpensesFirstName";
            this.EnterExpensesFirstName.Size = new System.Drawing.Size(147, 22);
            this.EnterExpensesFirstName.TabIndex = 1;
            //
            // EnterExpensesTitle
            //
            this.EnterExpensesTitle.AutoSize = true;
            this.EnterExpensesTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.EnterExpensesTitle.Location = new System.Drawing.Point(163, 28);
            this.EnterExpensesTitle.Name = "EnterExpensesTitle";
            this.EnterExpensesTitle.Size = new System.Drawing.Size(150, 25);
            this.EnterExpensesTitle.TabIndex = 0;
            this.EnterExpensesTitle.Text = "Enter Expenses";
            //
            // CancelEmployeeList
            //
            this.CancelEmployeeList.Location = new System.Drawing.Point(14, 52);
            this.CancelEmployeeList.Name = "CancelEmployeeList";
            this.CancelEmployeeList.Size = new System.Drawing.Size(75, 23);
            this.CancelEmployeeList.TabIndex = 15;
            this.CancelEmployeeList.Text = "Cancel";
            this.CancelEmployeeList.UseVisualStyleBackColor = true;
            this.CancelEmployeeList.Click += new System.EventHandler(this.CancelEmployeeList_Click);
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(123, 84);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(35, 17);
            this.label7.TabIndex = 1;
            this.label7.Text = "First";
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label11.Location = new System.Drawing.Point(168, 58);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(145, 24);
            this.label11.TabIndex = 0;
            this.label11.Text = "Add Employees";
            //
            // UpdateEmployeesPanel
            //
            this.UpdateEmployeesPanel.Controls.Add(this.ErrorMessage);
            this.UpdateEmployeesPanel.Controls.Add(this.SelectErrorMessage);
            this.UpdateEmployeesPanel.Controls.Add(this.UpdateButton);
            this.UpdateEmployeesPanel.Controls.Add(this.Remove);
            this.UpdateEmployeesPanel.Controls.Add(this.Modify);
            this.UpdateEmployeesPanel.Controls.Add(this.SelectDepartment);
            this.UpdateEmployeesPanel.Controls.Add(this.DepartmentLabel);
            this.UpdateEmployeesPanel.Controls.Add(this.SelectLastName);
            this.UpdateEmployeesPanel.Controls.Add(this.SelectFirstName);
            this.UpdateEmployeesPanel.Controls.Add(this.label13);
            this.UpdateEmployeesPanel.Controls.Add(this.UpdateEmployeeTitle);
            this.UpdateEmployeesPanel.Controls.Add(this.label12);
            this.UpdateEmployeesPanel.Controls.Add(this.ShowList);
            this.UpdateEmployeesPanel.Location = new System.Drawing.Point(3, 49);
            this.UpdateEmployeesPanel.Name = "UpdateEmployeesPanel";
            this.UpdateEmployeesPanel.Size = new System.Drawing.Size(485, 366);
            this.UpdateEmployeesPanel.TabIndex = 10;
            //
            // ErrorMessage
            //
            this.ErrorMessage.Location = new System.Drawing.Point(13, 302);
            this.ErrorMessage.Name = "ErrorMessage";
            this.ErrorMessage.Size = new System.Drawing.Size(459, 22);
            this.ErrorMessage.TabIndex = 16;
            //
            // SelectErrorMessage
            //
            this.SelectErrorMessage.Location = new System.Drawing.Point(17, 356);
            this.SelectErrorMessage.Name = "SelectErrorMessage";
            this.SelectErrorMessage.Size = new System.Drawing.Size(445, 22);
            this.SelectErrorMessage.TabIndex = 15;
            //
            // UpdateButton
            //
            this.UpdateButton.Location = new System.Drawing.Point(16, 206);
            this.UpdateButton.Name = "UpdateButton";
            this.UpdateButton.Size = new System.Drawing.Size(75, 23);
            this.UpdateButton.TabIndex = 14;
            this.UpdateButton.Text = "Update";
            this.UpdateButton.UseVisualStyleBackColor = true;
            this.UpdateButton.Visible = false;
            this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
            //
            // Remove
            //
            this.Remove.Location = new System.Drawing.Point(119, 177);
            this.Remove.Name = "Remove";
            this.Remove.Size = new System.Drawing.Size(75, 23);
            this.Remove.TabIndex = 13;
            this.Remove.Text = "Remove";
            this.Remove.UseVisualStyleBackColor = true;
            this.Remove.Click += new System.EventHandler(this.Remove_Click);
            //
            // Modify
            //
            this.Modify.Location = new System.Drawing.Point(16, 177);
            this.Modify.Name = "Modify";
            this.Modify.Size = new System.Drawing.Size(75, 23);
            this.Modify.TabIndex = 8;
            this.Modify.Text = "Modify";
            this.Modify.UseVisualStyleBackColor = true;
            this.Modify.Visible = false;
            this.Modify.Click += new System.EventHandler(this.Modify_Click);
            //
            // SelectDepartment
            //
            this.SelectDepartment.Location = new System.Drawing.Point(224, 136);
            this.SelectDepartment.Name = "SelectDepartment";
            this.SelectDepartment.Size = new System.Drawing.Size(208, 22);
            this.SelectDepartment.TabIndex = 7;
            //
            // DepartmentLabel
            //
            this.DepartmentLabel.AutoSize = true;
            this.DepartmentLabel.Location = new System.Drawing.Point(123, 139);
            this.DepartmentLabel.Name = "DepartmentLabel";
            this.DepartmentLabel.Size = new System.Drawing.Size(82, 17);
            this.DepartmentLabel.TabIndex = 6;
            this.DepartmentLabel.Text = "Department";
            //
            // SelectLastName
            //
            this.SelectLastName.Location = new System.Drawing.Point(224, 107);
            this.SelectLastName.Name = "SelectLastName";
            this.SelectLastName.Size = new System.Drawing.Size(208, 22);
            this.SelectLastName.TabIndex = 5;
            //
            // SelectFirstName
            //
            this.SelectFirstName.Location = new System.Drawing.Point(42, 106);
            this.SelectFirstName.Name = "SelectFirstName";
            this.SelectFirstName.Size = new System.Drawing.Size(157, 22);
            this.SelectFirstName.TabIndex = 4;
            //
            // label13
            //
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(221, 81);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(76, 17);
            this.label13.TabIndex = 3;
            this.label13.Text = "Last Name";
            //
            // UpdateEmployeeTitle
            //
            this.UpdateEmployeeTitle.AutoSize = true;
            this.UpdateEmployeeTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.UpdateEmployeeTitle.Location = new System.Drawing.Point(167, 24);
            this.UpdateEmployeeTitle.Name = "UpdateEmployeeTitle";
            this.UpdateEmployeeTitle.Size = new System.Drawing.Size(167, 25);
            this.UpdateEmployeeTitle.TabIndex = 0;
            this.UpdateEmployeeTitle.Text = "Update Employee";
            //
            // label12
            //
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(123, 81);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(76, 17);
            this.label12.TabIndex = 2;
            this.label12.Text = "First Name";
            //
            // ShowList
            //
            this.ShowList.Location = new System.Drawing.Point(16, 75);
            this.ShowList.Name = "ShowList";
            this.ShowList.Size = new System.Drawing.Size(75, 23);
            this.ShowList.TabIndex = 1;
            this.ShowList.Text = "ShowList";
            this.ShowList.UseVisualStyleBackColor = true;
            this.ShowList.Click += new System.EventHandler(this.ShowList_Click);
            //
            // DisplayExpensesDescription
            //
            this.DisplayExpensesDescription.Location = new System.Drawing.Point(36, 119);
            this.DisplayExpensesDescription.Name = "DisplayExpensesDescription";
            this.DisplayExpensesDescription.Size = new System.Drawing.Size(160, 22);
            this.DisplayExpensesDescription.TabIndex = 19;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(500, 525);
            this.Controls.Add(this.NavigationPanel);
            this.Controls.Add(this.MenuPanel);
            this.Name = "Form1";
            this.Text = "Expense It";
            this.NavigationPanel.ResumeLayout(false);
            this.MenuPanel.ResumeLayout(false);
            this.MenuPanel.PerformLayout();
            this.AddEmployeesPanel.ResumeLayout(false);
            this.AddEmployeesPanel.PerformLayout();
            this.ListPanel.ResumeLayout(false);
            this.ListPanel.PerformLayout();
            this.DisplayExpensesPanel.ResumeLayout(false);
            this.DisplayExpensesPanel.PerformLayout();
            this.EnterExpensesPanel.ResumeLayout(false);
            this.EnterExpensesPanel.PerformLayout();
            this.UpdateEmployeesPanel.ResumeLayout(false);
            this.UpdateEmployeesPanel.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel NavigationPanel;
        private System.Windows.Forms.Button rightArrow;
        private System.Windows.Forms.Button leftArrow;
        private System.Windows.Forms.Panel MenuPanel;
        private System.Windows.Forms.Button Expenses;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Button UpdateEmployee;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button AddEmployee;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Panel AddEmployeesPanel;
        private System.Windows.Forms.TextBox Department;
        private System.Windows.Forms.TextBox LastName;
        private System.Windows.Forms.TextBox FirstName;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label UpdateEmployeeTitle;
        private System.Windows.Forms.Button AddEnteredEmployee;
        private System.Windows.Forms.TextBox ErrorMessageBox;
        private System.Windows.Forms.Panel UpdateEmployeesPanel;
        private System.Windows.Forms.Button ShowList;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.TextBox SelectErrorMessage;
        private System.Windows.Forms.Button UpdateButton;
        private System.Windows.Forms.Button Remove;
        private System.Windows.Forms.Button Modify;
        private System.Windows.Forms.TextBox SelectDepartment;
        private System.Windows.Forms.Label DepartmentLabel;
        private System.Windows.Forms.TextBox SelectLastName;
        private System.Windows.Forms.TextBox SelectFirstName;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Panel ListPanel;
        private System.Windows.Forms.ListBox employeeList;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.Button CancelEmployeeList;
        private System.Windows.Forms.Label ListPanelTitle;
        private System.Windows.Forms.TextBox ErrorMessage;
        private System.Windows.Forms.Panel EnterExpensesPanel;
        private System.Windows.Forms.Label EnterExpensesTitle;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox EnterExpensesDepartment;
        private System.Windows.Forms.TextBox EnterExpensesLastName;
        private System.Windows.Forms.TextBox EnterExpensesFirstName;
        private System.Windows.Forms.TextBox EnterExpensesDate;
        private System.Windows.Forms.TextBox EnterExpensesAmount;
        private System.Windows.Forms.TextBox EnterExpensesDescription;
        private System.Windows.Forms.Button EnterExpensesDone;
        private System.Windows.Forms.Button EnterExpensesButton;
        private System.Windows.Forms.TextBox ErrorExpensesErrorMessage;
        private System.Windows.Forms.Button Display;
        private System.Windows.Forms.Panel DisplayExpensesPanel;
        private System.Windows.Forms.TextBox DisplayExpensesFirstName;
        private System.Windows.Forms.ListBox DescListBox;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.TextBox DisplayExpensesDescription;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.TextBox DisplayExpensesLastName;
        private System.Windows.Forms.TextBox DisplayExpensesDepartment;
        private System.Windows.Forms.ListBox DateListBox;
        private System.Windows.Forms.Label label21;
        private System.Windows.Forms.Label label19;
        private System.Windows.Forms.ListBox AmtListBox;
        private System.Windows.Forms.Button DisplayExpensesDone;
    }

}

Friday, October 12, 2018

C# Displays Follow On for ExpenseIt Showing Version of Navigation Bar



This post will show my attempt at doing a navigation bar with the ExpenseIt non WPF (Windows Presentation Foundation) application example of Microsoft as I implemented using only Windows Forms and C# with the Microsoft Access database provided to avoid the need for canned data.  (See the previous post “C# Displays Follow On for ExpenseIt Using Access Database” for the basic structure of the application that is being modified with its various Windows forms.)

Leaping into the task of implementing the navigation arrow buttons, as I have been prone to do of late since coding is so easy – just add code, compile, correct errors, compile again, etc – I have gotten out of the habit of thinking things through first.  So I had a couple of false starts and also ended up with excessive code.  In addition I had a couple of lapses.

The first dope slap was when I switched from my usual “list” construct that is a replacement for a queue to a circular queue to maintain the form selections.  I had been mystified by the other Windows Forms not being able to access the selections pushed onto queue by the Menu form.  Then, of a sudden, it dawned on me.  I had created new instances of the database classes for access by each of the “worker” forms and so had done so for the circular queue as well.  But the insight came to me that the reason these forms couldn’t read the previous menu selections was because the forms had their own versions of the queue.  That this didn’t matter for the database classes since the data was stored in the Access database tables and not in the C# class.  But that that this wasn’t the case for the circular queue where it stored the data so a new instance of the class meant an empty queue.  So I needed to pass the instance of the queue of Form1 – the Menu form – to the other forms as Form1 instantiated them.

In the end I didn’t use the circular queue anyway since I hadn’t thought through how I was going to access it to obtain what the next left or right form selection might be.  When I realized it wasn’t quite as simple as I had assumed and actually made samples of what would go into the queue I replaced the code of the SelectionQueue class that I had created to return to a simple array once more.  That is, a version of my usual list construct for a queue.  And even simpler since there would be no need to “pop” the queue – the array was never going to get very long since there would only be a maximum of five entries.  But the need to pass the Form1 (master form) instantiation of the class to the other forms was a lesson learned.

So I implemented the arrow buttons and changed the displayed forms, hiding the currently displayed form and showing the newly selected form.  As I proceeded I came to realize that I had an excess of repeated code.  That is, since each form had its own pair of arrow buttons, each had its own pair of button click event handlers.  So each came to have its own repeated code to determine what the navigation arrow had selected.  Therefore, a need to consolidate into, perhaps, a new Navigation class to contain the code to implement the button event.

This got be to thinking (for a change) and I thought about the navigation bar of web displays and also of such things as the tool bars that get added to forms.  It seemed to me that there needed to be a super form so that the Navigation Bar could be part of it along with the form title and the minimize, maximize, and terminate buttons of the upper right corner.  So, whether there was an option that could be used to overlay another form below the upper portion that would display a boundary but not a title and the upper right buttons.

Then the navigation arrows would be in the super form and not the individual forms so there would only be one set of mouse click event methods.  Or, lacking that, even with multiple mouse click event methods, they could all be treated by the same instance of a navigation class rather than having separate code in each of my forms.  (This preceded the completion of the code by half a day and finding that each arrow click event handler had the same code as mentioned in the paragraph above).

Then it occurred to me that I could treat a panel like a form.  That is, have one form rather than four with the panel of the arrow buttons and a lower set of panels for what I am now treating as individual forms.  Instead I could have multiple lower panels and change which lower panels are hidden and which is displayed when the Menu panel selections are made or the arrow buttons of the upper panel are clicked. 

This seems like a very possible course of action and something I should do next.  Although it takes me away from finding out about support for Windows threads vs Threading threads that I had a problem with when I tried to combine my framework with Windows Forms.  Then it occurred to me that I likely did such panels in the C# Display application that I did years ago that interfaced with the Ada framework applications.  Creeping into my consciousness is the thought that I did.  And that I have gotten into a mode of action first without much thought about my approach since so easy to code now and change later (as I mentioned above).  An UltraEdit search of the folders used for those applications shows that I did indeed use panels.

Since the code is currently rather ugly and will be replaced by using only one Windows form and multiple panels I will not present it here.  Instead here are the pages showing the navigation arrow keys after the menu selections were made to show the Add Employees, Update Employees, Enter Expenses, and Display Expenses. 

Because of the order of selection, there is no selection to the left of the Menu and none to the right of Display Expenses.  Note: As presented in the previous post, these last two Menu selections both display a list of employees for a choice of the employee for which the expenses are to be entered or displayed.  So both appear the same except there is no right arrow for the Display of the employees Expenses.