To get preferences to work to/from the smartdashboard here is what I had to do in java. C++ will be similar.
Code:
On the robot:
// declare variable
NetworkTable preferencesTable;
// in robotInit get or create singleton instance (getTable will get instance if it exists or create one if it does not.
preferencesTable = NetworkTable.getTable("Preferences");
// write some test data
preferencesTable.putString("pref1", "998899");
preferencesTable.putString("pref2", "77777");
// in teleopPeriodic for test purposes get the data
System.out.println( "pref1 = " + preferencesTable.getString("pref1", "Empty"));
System.out.println( "pref2 = " + preferencesTable.getString("pref2", "Empty"));
Start running smartdashboard on the DS with the Preferences grid open.
Start program on robot with above code included. The two initial values for pref1 and pref2 should show on the grid. Enable teleop and you should see the two values on the console. Now edit the values in the preferences grid on the smartdashboard, the values should change on the console.
One caveat, use putString and getString not one of the other methods such as getDouble, getInt, etc. In my first test I used putInt to set the initial values and getInt to retrieve them. When I changed the values on the smartdashboard, they stopped displaying in the console. Smartdashboard sends everything as a string. You will need to parse to a number on the cRio.
The save button is not necessary unless you want to save the table values to flash memory on the crio. They could then be read in at startup. There is a cautionary comment that too much saving can damage the flash memory of the crio. Don't do it in your periodic or continuous methods, only when necessary.