CSharpUser 0 Light Poster

Hi,
I am using Windows Forms (not WPF) to create video controls on the form to view the output from a video stream. What I want to do is based on a list of IP addresses (the addresses being of encoders capturing the video and making it available via a URL), create a viewing control for each item. This is all being done using a 3rd party library.
I have no problem creating multiple objectes with the supplied DLL and setting the standard control properties. However, when I try to set any of the control custom properties I get:
An unhandled exception of type 'System.Windows.Forms.AxHost.InvalidActiveXStateException'

This is all happening in the Form's constructor. The code is:

        public Form1()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            InitializeComponent();

            AMC2.Enabled = false;
            AMC2.Visible = false;
            AxAXISMEDIACONTROLLib.AxAxisMediaControl AMC3 = new AxAxisMediaControl();
            AMC3.Enabled = true;
            AMC3.Location = new Point(126, 580);
            AMC3.Name = "NewName";
            AMC3.Size = new Size(720, 560);
            Controls.Add(AMC3);
            AMC3.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("AMC3.OcxState")));
            AMC3.MediaUsername = "root"; //ERROR IS THROWN HERE
            AMC3.MediaPassword = "pass";
            AMC3.MediaURL = "axrtsphttp://99.999.999.99/axis-media/media.amp";
            AMC3.MediaType = "h264";
            AMC3.Play();
        }

Can anyone tell me where I am going wrong here?

Thanks in advance for any help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.