AnsweredAssumed Answered

E8257D local mode vs dispose

Question asked by juanma001 on Jan 29, 2016
Hello. I am programming an E8257D Signal Generator in Visual Studio 2015 via LAN. My C# code is the following:
class Program
    {
        private MessageBasedSession mbSession;
        static void Main(string[] args)
        {
           MessageBasedSession mbSession = (MessageBasedSession)ResourceManager.GetLocalManager().Open("TCPIP::192.168.100.20::inst0::INSTR");         
            mbSession.Write("*IDN?");
            string temp = mbSession.ReadString();
            Console.WriteLine(temp);
            Console.WriteLine("Done1");
            mbSession.Write("SYST:COMM:GTL\n");
            Console.WriteLine("Done2");
            try
            {
                mbSession.Dispose();
                mbSession = null;
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
    }
After "mbSession.Write("SYST:COMM:GTL\n"); the E8257D goes to LOCAL mode but with Dispose(), it come back again to REMOTE mode. I want the instrument in LOCAL mode when I close the session and keep this LOCAL mode after that. Any suggestion. Thanks.  

Outcomes