1

I'm having trouble on adding a UserControl to my Form.

UserControl Code:

using System;
using System.Windows.Forms;

namespace Most.Mobile.AFV.UI.Controls
{
    public partial class ListActionBar : UserControl
    {
        public ListActionBar()
        {
            InitializeComponent();
        }

        public bool ShowKeyboardButton
        {
            get { return mtbKeyboard.Visible; }
            set { mtbKeyboard.Visible = value; }
        }

        public bool ShowOpenButton
        {
            get { return mtbMenu.Visible; }
            set { mtbMenu.Visible = value; }
        }

        public bool ShowDeleteButton
        {
            get { return mtbDelete.Visible; }
            set { mtbDelete.Visible = value; }
        }

        public bool ShowBackButton
        {
            get { return mtbBack.Visible; }
            set { mtbBack.Visible = value; }
        }

        public bool ShowEditButton
        {
            get { return mtbEdit.Visible; }
            set { mtbEdit.Visible = value; }
        }

        public bool ShowNewButton
        {
            get { return mtbNew.Visible; }
            set { mtbNew.Visible = value; }
        }

        public event EventHandler NewClick;
        public event EventHandler DeleteClick;
        public event EventHandler EditClick;
        public event EventHandler OpenClick;

        private void mtbBack_Click(object sender, EventArgs e)
        {
            if (Parent == null)
                return;

            if (Parent is Form)
                (Parent as Form).DialogResult = DialogResult.Cancel;
        }

        private void mtbKeyboard_Click(object sender, EventArgs e)
        {
            inp.Enabled = !inp.Enabled;
        }

        private void mtbNew_Click(object sender, EventArgs e)
        {
            if (NewClick != null)
                NewClick(sender, e);
        }

        private void mtbEdit_Click(object sender, EventArgs e)
        {
            if (EditClick != null)
                EditClick(sender, e);
        }

        private void mtbDelete_Click(object sender, EventArgs e)
        {
            if (DeleteClick != null)
                DeleteClick(sender, e);
        }

        private void mtbMenu_Click(object sender, EventArgs e)
        {
            if (OpenClick != null)
                OpenClick(sender, e);
        }
    }
}

Below a picture of the error

Error image

Error description:

Failed to create component '' 'System.IO.FileLoadException:Could not load file or assembly 'Microsoft.WindowsCE.Forms, Version=3.5.0.0, CUlture=neutral, PublicKeyToken=969db8053d3322ac' or one of its dependencies.

ridermansb
  • 10,779
  • 24
  • 115
  • 226

1 Answers1

-1

The visual studio designer instantiates the control when displaying it in the designer view. when you get errors like this it normally means you have a runtime bug. if it compiles, try running the code (without opening it up in designer) and see where/if it crashes.

Vman
  • 3,016
  • 2
  • 24
  • 20
  • Another detail I forgot to mention: The project is on Windows Mobile 6.5. On my machine, this error does not happen. The error happens only on the machine of my colleague In runtime mode works perfectly – ridermansb Mar 25 '11 at 13:33