// Load form settings when program starts void LoadSettings() { // Create a shortcut for settings Properties.Settings p = Properties.Settings.Default; // Load the user's data ConfigureConnection.SelectedIndex = p.Tab; tbPrinterIPAddress.Text = p.IPAddress; tbPrinterPort.Text = p.IPPort; cbPrinterPortName.Text = p.SerialPort; cbPrinterBaudRate.Text = p.SerialBaudRate; cbPrinterDataBits.Text = p.SerialDataBits; cbPrinterParity.Text = p.SerialParity; cbPrinterStopBits.Text = p.SerialStopBits; txtMessageFolder.Text = p.MessageFolder; txtLogFile.Text = p.LogFile; }
// Save form settings on exit void SaveSettings() { // Create a shortcut for settings Properties.Settings p = Properties.Settings.Default; // Save the user's data p.Tab = ConfigureConnection.SelectedIndex; p.IPAddress = tbPrinterIPAddress.Text; p.IPPort = tbPrinterPort.Text; p.SerialPort = cbPrinterPortName.Text; p.SerialBaudRate = cbPrinterBaudRate.Text; p.SerialDataBits = cbPrinterDataBits.Text; p.SerialParity = cbPrinterParity.Text; p.SerialStopBits = cbPrinterStopBits.Text; p.MessageFolder = txtMessageFolder.Text; p.LogFile = txtLogFile.Text; p.Save(); }