Example #1
0
        private void btn_AddComponent_Click(object sender, EventArgs e)
        {
            //sets the values in the ECDataGridView Class to the text box texts in this form
            ECDataGridViewClass EC = new ECDataGridViewClass();

            try
            {
                ECDataGridViewClass.PartNo = txt_PN.Text;
            }

            catch (FormatException)
            {
                ECDataGridViewClass.PartNo = "";
            }

            try
            {
                ECDataGridViewClass.ManufacturerNo = txt_MN.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.ManufacturerNo = "";
            }
            try
            {
                ECDataGridViewClass.ComponentType = txt_CT.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.ComponentType = "";
            }
            try
            {
                ECDataGridViewClass.Package = txt_P.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.Package = "";
            }
            try
            {
                ECDataGridViewClass.Value = txt_V.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.Value = "";
            }
            try
            {
                ECDataGridViewClass.ManufacturerNo = txt_MN.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.ManufacturerNo = "";
            }
            try
            {
                ECDataGridViewClass.UnitPrice = txt_UP.Text;
            }
            catch (FormatException)
            {
                ECDataGridViewClass.UnitPrice = "";
            }

            try
            {
                ECDataGridViewClass.Stock = int.Parse(txt_S.Text.ToString());
            }
            catch (FormatException)
            {
                ECDataGridViewClass.Stock = 0;
            }

            ECDataGridViewClass.NACP1 = txt_NACP1.Text;
            ECDataGridViewClass.NACP2 = txt_NACP2.Text;
            ECDataGridViewClass.NACP3 = txt_NACP3.Text;
            //

            //Sets the component names and values in the ManageInputs class
            ManageInputs M = new ManageInputs();

            M.AddComponentToList(txt_CT.Text, txt_V);
            //The lists set by this method will be used to populate combobox

            this.Close();
        }