Keysight Signal Generators Programming Guide 367
 Creating and Downloading User–Data Files
Save and Recall Instrument State Files
Perform the following steps to run the State_Files program. 
1. Copy the State_Files.cs file from the CD–ROM programming examples section to the directory 
where the .NET Framework is installed. 
2. Change the TCPIP0 address in the program from TCPIP0::000.000.000.000 to your signal 
generator’s address.
3. Save the file using the .cs file name extension.
4. Run the Command Prompt program. Start > Run > "cmd.exe". Change the directory for the 
command prompt to the location where the .NET Framework was installed. 
5. Type csc.exe State_Files.cs at the command prompt and then press the Enter key on the keyboard 
to run the program. The following figure shows the command prompt interface. 
The State_Files.cs program is listed below. You can copy this program from the examples directory on 
the signal generator’s Documentation CD–ROM. 
NOTE The  State_Files.cs example uses the ESG in the programming code but can be used with the 
PSG or Keysight MXG.
//****************************************************************************************
// FileName: State_Files.cs
// 
// This C# example code saves and recalls signal generator instrument states. The saved 
// instrument state files are written to the local computer directory computer where the 
// State_Files.exe is located. This is a console application that uses DLL importing to 
// allow for calls to the unmanaged Keysight IO Library VISA DLL.
//