Есть код с моим элементом управления, который я наследую от Combobox:
| Код | using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms;
namespace SerialPorts { public class SerialPortCombobox : ComboBox { private void InitializeComponent() { this.SuspendLayout(); // // SerialPortCombobox // this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.Items.AddRange(new object[] { "1", "2", "3", "4", "5"}); this.ResumeLayout(false);
} } }
|
Компилирую, делаю DLL-ку. Создаю проект Windows Forms, чтобы протестировать новообразованный элемент управления. Добавляю на его на Toolbox, а оттуда уже на форму кидаю. На форме в режиме дизайна отразился, всё нормально. Запускаю приложение: пишет такую ошибку:
| Код | Подробная информация об использовании оперативной (JIT) отладки вместо данного диалогового окна содержится в конце этого сообщения.
************** Текст исключения ************** System.ArgumentException: Assembly 'C:\...\SerialPorts\obj\Debug\SerialPorts.dll' doesn't contain any UserControl types. в Microsoft.VisualStudio.Tools.UserControlTestContainer.UserControlTestContainer_Load(Object sender, EventArgs e) в System.Windows.Forms.Form.OnLoad(EventArgs e) в System.Windows.Forms.Form.OnCreateControl() в System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) в System.Windows.Forms.Control.CreateControl() в System.Windows.Forms.Control.WmShowWindow(Message& m) в System.Windows.Forms.Control.WndProc(Message& m) в System.Windows.Forms.ScrollableControl.WndProc(Message& m) в System.Windows.Forms.ContainerControl.WndProc(Message& m) в System.Windows.Forms.Form.WmShowWindow(Message& m) в System.Windows.Forms.Form.WndProc(Message& m) в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
Как решить эту проблему? |