// Private functions // ***************** private void DisplayProduct(product p) { if (p != null) { ProductIDTextBox.Text = p.productID.ToString(); ConditionTextBox.Text = p.condition; CostTextBox.Text = "$" + p.cost.ToString(); // Product Info PlatformTextBox.Text = p.platform; OSTextBox.Text = p.OS; ManufacturerTextBox.Text = p.manufacturer; ModelTextBox.Text = p.model; // Tech Specs MemoryTextBox.Text = p.RAM_size; LCDSizeTextBox.Text = p.screensize; HDDTextBox.Text = p.HDD_size; CPUBrandTextBox.Text = p.CPU_brand; CPUNumberTexBox.Text = p.CPU_number; GPUTypeTextBox.Text = p.GPU_Type; CPUTypeTextBox.Text = p.CPU_type; CPUSpeedTextBox.Text = p.CPU_speed; WebcamTextBox.Text = p.webcam; NextButton.Enabled = true; } else { ProductIDTextBox.Clear(); ConditionTextBox.Clear(); CostTextBox.Clear(); // Product Info PlatformTextBox.Clear(); OSTextBox.Clear(); ManufacturerTextBox.Clear(); // Tech Specs MemoryTextBox.Clear(); LCDSizeTextBox.Clear(); HDDTextBox.Clear(); CPUBrandTextBox.Clear(); CPUNumberTexBox.Clear(); GPUTypeTextBox.Clear(); CPUTypeTextBox.Clear(); CPUSpeedTextBox.Clear(); WebcamTextBox.Clear(); NextButton.Enabled = false; } }
//Writing method private void _SaveInfo() { //makes sure user is ready to save DialogResult UserResult = MessageBox.Show("Are You Sure?", "Confirm", MessageBoxButtons.YesNo); if (UserResult == DialogResult.Yes) { // Open a writer and Write to the file _writer = new StreamWriter("Product.txt", true); _writer.WriteLine(ProductIDTextbox.Text + _DELIMETER + ConditionTextbox.Text + _DELIMETER + CostTextbox.Text + _DELIMETER + PlatformTextBox.Text + _DELIMETER + ManufactuerTextbox.Text + _DELIMETER + OSTextbox.Text + _DELIMETER + ModelTextBox + _DELIMETER + MemoryTextBox.Text + _DELIMETER + LCDTextbox.Text + _DELIMETER + HDDTextbox.Text + _DELIMETER + CPUBrandTextbox.Text + _DELIMETER + CPUNumberTextbox.Text + _DELIMETER + CPUSpeedTextbox.Text + _DELIMETER + GPUTextbox.Text + _DELIMETER + WebcamTextbox.Text); //Close the file _writer.Close(); // Resets all boxes ProductIDTextbox.Clear(); ConditionTextbox.Clear(); CostTextbox.Clear(); PlatformTextBox.Clear(); ManufactuerTextbox.Clear(); OSTextbox.Clear(); ModelTextBox.Clear(); MemoryTextBox.Clear(); LCDTextbox.Clear(); HDDTextbox.Clear(); CPUBrandTextbox.Clear(); CPUNumberTextbox.Clear(); CPUTypeTextbox.Clear(); GPUTextbox.Clear(); CPUSpeedTextbox.Clear(); WebcamTextbox.Clear(); } }
// reset the form; private void ResetForm() { ProductIDTextBox.Clear(); ConditionTextBox.Clear(); CostTextBox.Clear(); PlatformTextBox.Clear(); OSTextBox.Clear(); ManufacturerTextBox.Clear(); ModelTextBox.Clear(); MemoryTextBox.Clear(); LCDSizeTextBox.Clear(); HDDTextBox.Clear(); CPUBrandTextBox.Clear(); CPUNumberTextBox.Clear(); GPUTypeTextBox.Clear(); CPUTypeTextBox.Clear(); CPUSpeedTextBox.Clear(); WebCamTextBox.Clear(); }
private void ResetForm() { ProductTextBox.Clear(); ConditionTextBox.Clear(); CostTextBox.Clear(); PlatFormTextBox.Clear(); OsTextBox.Clear(); ManuFacTextBox.Clear(); ModelTextBox.Clear(); MemoryTextBox.Clear(); LCDTextBox.Clear(); HDDTextBox.Clear(); CPUBTextBox.Clear(); CPUNumTextBox.Clear(); GPUTTextBox.Clear(); CPUTTextBox.Clear(); CPUspeedTextBox.Clear(); WebCamTextBox.Clear(); }