コード例 #1
0
        }//end of remove

        private void BtnSave_Click(object sender, EventArgs e)
        {//start of BtnSave
            BtnPrintSaved.Show();
            //displays print button

            string lableData = LblTotal.Text;
            //new var lableData has the value of LblTotal

            string filename = "T:\\" + LblNumberGen.Text + ".txt";
            //this is creating a variable to be saved in the t drive

            string listboxData = "";

            //this is creating the listbox but keeping it empty

            foreach (string str in LstOrder.Items)
            //creating variable that contains the value of the items in the stocklist

            {//start of foreach
                listboxData += str + "\r\n";
                //return and new line
                //use the str variable and the data from the list box to be stored
            }//end of foreach

            listboxData += lableData + "\r\n";
            //return and new line
            //use the str variable and the data from the list box to be stored

            File.WriteAllText(filename, listboxData);
            //this will write all text from the listboxdata into the variable filename
        }//end of BtnSave
コード例 #2
0
        }//end of BtnSave

        private void OrderForm_Load(object sender, EventArgs e)
        {//start of OrderForm
            LblTotal.Text = ("Total: £" + Convert.ToString(total));

            LblTime.Text = DateTime.Now.ToLongTimeString();
            //displays current Date in LblDate

            LblDate.Text = DateTime.Now.ToLongDateString();
            //displays current Date in LblDate

            String NumberGen = Convert.ToString(DateTime.Now);

            //var NumberGen = the current data and time

            NumberGen = NumberGen.Replace("/", "");
            //this is getting rid of the / in the date
            NumberGen = NumberGen.Replace(":", "");
            //this is getting rid of the : in the time
            NumberGen = NumberGen.Replace(" ", "");
            //this is getting rid of the " " in the time and date

            LblNumberGen.Text = NumberGen;
            //making the lable have the value of the NumberGen variable

            BtnPrintSaved.Hide();
            //hides the print button

            toolTip1.SetToolTip(BtnAdd, "The add button will add the selected item into the order list.");
            toolTip2.SetToolTip(BtnRemove, "The remove button will remove the selected item form the order list.");
            toolTip3.SetToolTip(BtnClear, "The clear button will remove all items in the order list.");
            toolTip4.SetToolTip(BtnSave, "The save button will save the current order list into a text file in the T drive. Remember to press the new order button after you have saved.");
            toolTip5.SetToolTip(BtnOpen, "The open button will let up open up an existing/allready saved order");
            toolTip6.SetToolTip(BtnNewOR, " The new order button will create a new OR number. You need to do this each time you save an order of you will keep overriding the same file.");
            toolTip7.SetToolTip(BtnPrint, "The print button will open a new form of the current order list for you to print out.");
            toolTip8.SetToolTip(BtnPrintSaved, "The print saved will let up print an existing/allready saved order.");
            toolTip9.SetToolTip(BtnExit, "The Close app button closes the whole appliction.");
            toolTip10.SetToolTip(BtnHowTo, "The How to use button takes you to the help page. ");
            toolTip11.SetToolTip(BtnVeg, "The veg button will open up the current veg stock.");
            toolTip12.SetToolTip(BtnFruit, "The fruit button will open up the current fruit stock.");
            toolTip13.SetToolTip(BtnChangeVeg, "The change veg button will open up a new form.");
            toolTip14.SetToolTip(BtnChangeFruit, "The change fruit button will open up a new form.");
        }//end of OrderForm