As a newbie, you should take a look at these links:
http://www.yoda.arachsys.com/csharp.../csharp/incomplete.htmlhttp://sscce.org/(some Java-centric stuff, but mostly applicable to any
programming questions)
They contain important advice regarding how to ask an effective,
answerable question. In particular, the great importance and usefulness
of providing a concise-but-complete code example that reliably reproduces,
demonstrates, or otherwise illustrates the problem.
Without a code example, we have no way to know what the "issue" is. The
error you quote seems to be self-explanatory: you are attempted to use
some type that is apparently unavailable at the time the component
(presumably the Designer) is attempting to use it.
This may yet again come down to you inappropriately modifying the
*.Designer.cs file, or it could be something else. If it's the former,
then the solution is clear: don't modify the *.Designer.cs file. Only the
Designer itself should be doing that. If it's something else, then you
need to provide more context.
As for the "UserControl" class itself...
I'm sure Google can turn up a number of examples. But, the basic idea is:
the UserControl class is a specific kind of container class that the
Designer knows about, and which allows you to create a standalone,
editable UserControl-derived class within the Designer. It's primary use
is as a container, in which you place other controls in order to create a
new, user-defined aggregate control.
It's actually very much like a Form, except that it's intended to be used
inside a Form or other container, rather than being a top-level window
unto itself.
Again, we have no idea what "issue" you're describing, never mind whether
it's "known". Ideally, you will provide a concise-but-complete code
example that reliably demonstrates the problem. Barring that, it mightbe
helpful if you would at the very least provide references that describe
this "known issue"; on the assumption that your references simply describe
exactly the situation you're in (i.e. not just the error message), those
references could help us understand the problem too.
Pete
After researching UserControls a bit, I am still unsure as to how they
have been applied as a workaround to this issue. Any suggestions are
greatly welcomed. And, my apologies for the lack of detail in my
initial explanation. Hopefully the code I have written below will
help guide towards a solution for anyone with experience on this
subject. Thanks in advance for your help everyone.
Below is the code that is producing the error:
Could not find type 'Example.NewObjComboBox'. Please make sure that
the assembly that contains this type is referenced. If this type is a
part of your development project, make sure that the project has been
successfully built.
--------------------Form.cs-CODE
SAMPLE------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Example {
public partial class Form1 : Form {
private NewObjComboBox<NewObj> comboBox1;
public Form1() {
InitializeComponent();
AddNewObjToItems();
}
public void AddNewObjToItems() {
NewObj cbo = new NewObj("1");
this.comboBox1.Items.Add(cbo);
this.Controls.Add(this.comboBox1);
this.comboBox1.ResumeLayout(false);
this.comboBox1.PerformLayout();
this.ResumeLayout(false);
}
}
public class NewObjComboBox<ClassType> : ComboBox {
private NewObjList<ClassType> m_list;
public NewObjComboBox() {
m_list = new NewObjList<ClassType>(base.Items);
}
new public NewObjList<ClassType> Items {
get { return m_list; }
}
}
public struct NewObj {
private string comboboxentry;
public NewObj(string c_box_var) {
comboboxentry = c_box_var;
}
public string ComboBoxEntry { get { return comboboxentry; } }
public override string ToString() {
return string.Format("{0}", ComboBoxEntry);
}
}
public class NewObjList<ClassType> //: IList<System.Object>
{
private ComboBox.ObjectCollection m_coll;
public NewObjList(ComboBox.ObjectCollection c) {
m_coll = c;
}
#region IList<object> Members
// Contains a list of members when interface implementation
tool is invoked
#endregion
}
-----------------------END OF Form.cs CODE
SAMPLE----------------------------------------
--------------------------------Form.Designer.cs InitializeComponent
method---CODE SAMPLE----------------------
private void InitializeComponent() {
this.comboBox1 = new NewObjComboBox<NewObj>();
this.comboBox1.SuspendLayout();
this.SuspendLayout();
//
// comboBox1
this.comboBox1.Anchor =
((System.Windows.Forms.AnchorStyles.Bottom
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.comboBox1.DropDownWidth = 280;
this.comboBox1.Location = new System.Drawing.Point(21,
20);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(284, 21);
this.comboBox1.TabIndex = 0;
// Form1
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(338, 67);
this.Name = "Form1";
this.Text = "New ComboBox";
}
-----------------------------END OF Form.Designer.cs
InitializeComponent---CODE SAMPLE---------