Beispiel #1
0
        private void LoadData()
        {
            List <ModelMebiusPanel> models = new List <ModelMebiusPanel>();
            var test = new ModelMebiusPanel
            {
                Name = "",
            };

            models.Add(test);
            var data = Ultils.ReadAllLines(path, Encoding.ASCII);

            foreach (var item in data)
            {
                ModelMebiusPanel model = null;
                string[]         array = null;
                if (item.Contains(","))
                {
                    array = item.Split(',');
                    model = new ModelMebiusPanel
                    {
                        Name = array[0],
                        Code = array[1],
                    };
                }
                models.Add(model);
            }


            cboModels.DataSource    = models;
            cboModels.DisplayMember = "Name";
            cboModels.ValueMember   = "Name";
        }
Beispiel #2
0
        private void cboModels_SelectedIndexChanged(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            string selectModel = null;

            if (cboModels.SelectedIndex > 0)
            {
                selectModel = cboModels.SelectedValue.ToString();

                var      data  = Ultils.ReadAllLines(path, Encoding.ASCII).SingleOrDefault(c => c.Contains(selectModel));
                string[] array = data.Split(',');
                _model = new ModelMebiusPanel()
                {
                    Name = array[0],
                    Code = array[1]
                };
                txtCode.Text = _model.Code;
                txtQuantity.Focus();
            }
        }