Serial Port Complete - Latest Microcontroller projects

(lily) #1
Using .NET’s SerialPort Class

The settings are stored in the file user.config, where user is the user name of the
person running the application. To enable using the settings, you must deploy
Visual Studio’s app.exe file with the project.

4

6 
0


An application might save its settings when executing the main form’s
_FormClosing routine. This example saves the selected items in three combo
boxes (cmbBitRate, cmbPort, and cmbHandshaking):

 Settings.Default.BitRate = CInt(cmbBitRate.SelectedItem)
Settings.Default.ComPort = cmbPort.SelectedItem.ToString
Settings.Default.Handshaking = DirectCast(cmbHandshaking.SelectedItem, Handshake)


Settings.Default.Save()

Figure 9-1: In Visual Studio’s Project > Properties windows, the Settings pane enables
defining application-specific values to be saved with an application.
Free download pdf