Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Custom Control making main control it is placed in blank

Custom Control making main control it is placed in blank

Scheduled Pinned Locked Moved C#
visual-studioquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MichCl
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups