Beispiel #1
0
        private void Go_Click(object sender, EventArgs e)
        {
            if (textBox9.Text != "")
            {
                List <string> itemdataArr;
                int           count = 0;
                itemdataArr = RT.getitemdataArray();

                foreach (string str in itemdataArr)
                {
                    if ((str.LastIndexOf(textBox3.Text + ",", StringComparison.OrdinalIgnoreCase) == 0))
                    {
                        itemdataArr[count] = textBox3.Text + "," + textBox4.Text;
                        label8.Text        = textBox3.Text + " price changed to " + textBox4.Text;
                        RT.setitemdataArray(itemdataArr);
                        break;
                    }
                    count++;
                }

                if (count == itemdataArr.Count)
                {
                    itemdataArr.Add(textBox3.Text + "," + textBox4.Text);
                    label8.Text = textBox3.Text + "," + textBox4.Text + " added to data sheet!";
                    RT.setitemdataArray(itemdataArr);
                }
            }
            else
            {
                MessageBox.Show("You must load a datasheet first!");
            }
        }
Beispiel #2
0
        public void timerTicked(object obg, EventArgs e)
        {
            List <string> itemdataArr;

            itemdataArr = RT.getitemdataArray();
            int price = 0;

            foreach (string str in itemdataArr)
            {
                if ((str.LastIndexOf(textBox3.Text + ",", StringComparison.OrdinalIgnoreCase) == 0))
                {
                    price = Convert.ToInt32(str.Split(',')[1]);
                    break;
                }
            }
            textBox4.Text = price.ToString();
            if (textBox3.Text == "")
            {
                textBox4.ReadOnly = true;
            }
            else
            {
                textBox4.ReadOnly = false;
            }
            //check array for item
            //if not found: Item not found
            //if found: display data and make price box non readonly

            sW.Stop();
            sW.Tick -= new EventHandler(timerTicked);
            first    = true;
        }