Custom Control making main control it is placed in blank
-
I am redesigning my code so that what used to be a child control is now a control displayed in another control, which is placed in a form. Unfortunately, when I add the Ko portion, it makes what is displayed in my form blacnk. I'm not sure why. It looks like this: (hit edit to view properly since website seems to delete all spaces) CrMfgTool Generic Ko VS Project frmUsrFrm.cs GenericPC.cs PC.cs class in proj --------- ---------- --------- | | |GetPC | |GetPC | | | ------>| |------->| | |--------- |---------- |--------- Some of the code: CrMfgTool frmUsrFrm.cs:
public partial class frmUser:Form
{
...
private void CreateSubForms()
{
this.SuspendLayout();
...
GenericCrWr.GenericPC gen = new GenericCrWr.GenericPC();
controls[i] = gen.GetPC(cb1, programDll, templateArr, itsDll, cert, i, cb1.cbInfos[i].boxID, this);
controls[i].Dock = DockStyle.None;
controls[i].Location = new Point(myDockLocationX[i], myDockLocationY[i]);
... //(it looks tiled with 3 other controls)
}Generic GenericPC.cs:
public partial class GenericPC : UserControl
{
//this control shows on main form (combo boxes,
//labels, text boxes, etc)
//ok when I comment out Ko's GetPC
public Control GetPC(USB_Comm.Box cbInstance, string dllSelected, TemplateH.Temp.TEMPL[] template, string dll, Cert.Cert.CERT cert0, int slaveIndex, int boxID, Form theParent) //ignore theParent...not using it
{
...
_assembly = Assembly.LoadFrom(itsDll);
_type = _assembly.GetType("CrWr.PC");
_objectInstance = Activator.CreateInstance(_type);
_parameters = new Object[] { cb, itsDll, templateArr, itsDll, cert, SlaveIndex, cb.cbInfos[SlaveIndex].boxID, this };
itsControl = new Control();
itsControl = (Control)_type.InvokeMember("GetPC", BindingFlags.Default | BindingFlags.InvokeMethod, null, _objectInstance, _parameters);
//trying to add this to make control returned show on my form
// correctly. Blank form appears when I do nothing with
// itsControl returned above.
//The following commented out line doesn't build.
//It says "Cannot
//ass