Object reference not set to an instance of an object GPSExtension

Discussion created by ponbalu007 on Jul 25, 2011
Hey Guys ,
I have made some previous posts for this problem but hasn't got a reply yet, I did some poking around and found these UID things ... See in the code  All I want is the form (desktop windows application) to show a specific map and display the gps point on the map, when i move the point should move to the new spot no tracing required , and Form some archive forum I found some codes that i put together for this project....
I get this error  
""System.NullReferenceException was caught
  Message="Object reference not set to an instance of an object."
       at ndkj.Form1.Detectgps_Click(Object sender, EventArgs e) in C:\Users\Balu\Documents\Visual Studio 2008\Projects\ndkj\ndkj\Form1.cs:line 80
  InnerException: ""

then here is the code I have
 private void Form1_Load(object sender, EventArgs e)
            myap = this.mapControl1 as IApplication;
            //initialize the real-time manager
            UID pUID = new UIDClass();
            pUID.Value = "{C994BFE6-47F1-4BAC-8F35-0743C7576673}";
            myap = null;
            m_gpsExt = myap.FindExtensionByCLSID(pUID) as IGpsExtension;

        private void Detectgps_Click(object sender, EventArgs e)
            #region example from EDN forum
            IGpsDisplayProperties pGpsDisplay;

            g_pFeedManager = new RealTimeFeedManagerClass();
            g_pFeedManager.GpsFeed.Connection.BaudRate=Convert.ToInt16( esriGpsBaudRate.esriGpsBaudRate38400);
            g_pFeedManager.GpsFeed.Connection.CommPort = 5;
            g_pFeedManager.GpsFeed.Connection.DataBits = 8;
            g_pFeedManager.GpsFeed.Connection.Parity = esriGpsParity.esriGpsParityNone;
            g_pFeedManager.GpsFeed.Connection.StopBits = esriGpsStopBits.esriGpsStopBits1;

            //esriGpsConnectionStatus status = g_pFeedManager.GpsFeed.TestStatus;

            //g_pFeedManager.RealTimeFeed = (IRealTimeFeed)g_pFeedManager.GpsFeed;
                pGpsDisplay = (IGpsDisplayProperties)g_pFeedManager;
                pGpsDisplay.AutoPan = true;
                mapControl1 = new MapControlClass();

                g_pFeedManager.Map = this.mapControl1.Map;

                // g_pFeedManager.RealTimeFeed.Start();
                //m_gpsExt = new
                g_pFeedManager = m_gpsExt.RealTimeFeedManager;
                m_realTimeFeed = g_pFeedManager.RealTimeFeed;
                ((IRealTimeFeedEvents_Event)m_realTimeFeed).PositionUpdated += new IRealTimeFeedEvents_PositionUpdatedEventHandler(Form1_PositionUpdated);
                if (m_realTimeFeed.Status == esriGpsConnectionStatus.esriGpsConnectionStatusClosed)
            catch(Exception ex)
                Console.Write("COM Error:" + ex.Message);

the error occured in this "
g_pFeedManager = m_gpsExt.RealTimeFeedManager;"
For The Fix I tried if(null == m_gpsExt)
and got same error so ,I tried to add
m_gpsExt = new GpsExtension Class();
and I got the red underline thingy and the pop up error said
" References to non-creatable objects must be obtained through other objects. "
Please Find the attached File and PLEASE HELP
I Greatly Appreciate your time on this
Thanks In Advance