add control problem with multiple framework

Without the stackform, everything works perfect but when I add a toolbar I get an error
at line this.Controls.Add(this.toolBar1);
,if I comment all lines with toolBar everything works perfect

error:
$exception {System.Exception: Exception
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control._SetParent()
at System.Windows.Forms.Control.set_Parent()
at ControlCollection.Add()
at DeKangoeroe.KMaankomst.InitializeComponent()
at DeKangoeroe.FormStack.Preload()
at DeKangoeroe.FormStack.Push()
at DeKangoeroe.Menu.btnKMreg_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.Yield()
at System.Windows.Forms.Application.DoEvents()
at DeKangoeroe.FormStack.Run()
at DeKangoeroe.Program.Main()
} System.Exception

suggestions



Answer this question

add control problem with multiple framework

  • lalit.arya

    That means these buttons are not in collection. What's collection size Perhaps, zero

    As to forms, whatever you do first time, there's JITing involved which adds few seconds to that first pass.



  • Andy H.

    Perhaps, you've set control parent to control itself at some point



  • Yanbo Zhang

    windows mobile 5.0 pocket pc phone emulator

  • Eric Kolotyluk

    public PatientInfo():base()
    {
    InitializeComponent();
    this.Controls.Add(toolBar1);
    }

    If I do this the problem is solved. I think it has to do with the preloading of the actual form and the initialising

    (actually I don't know) If somebody knows

    explain me

  • Nikhil Vaghela

    not really,

    I tried
    this.toolbar1.parent = this;

    and also this.toolbar1.parent= this.owner

  • ibisxin

    switch (toolBar1.Buttons.IndexOf(e.Button))

    toolBar1.Buttons.IndexOf(e.Button) gives for every button a value of -1



    +

    I have a menu. Independent of which form I start from the menu as first: it takes about 10 seconds
    If I close that form and start a second form, no matter which one: it takes 4-5 seconds

    is this an emulator issue
    No multithreading used yet



  • newbie_lg

    Have you tried not setting parent Also, is that SmartPhone or PPC project (I’m not sure toolbar is supported on SP) Which device you're running on



  • Jeffrey Irish

    If i comment the: this.Controls.Add(this.toolBar1)

    I get a scrollbar, and the form is doubled (twice the same form)


  • Chilirecords

    I'm googling all the time and I found allready something like this.
    But how

  • Engineer31

  • larspl

    I'm not quit sure what you mean by that. You have bunch of forms, you show them with Show() or ShowDialog() as needed, you hide them after you done.



  • Marko Seifert

       
    Re: add control problem with multiple framework
    Comment     Reply Quote Delete Edit
       
    I'll try to make something myself.
    I had a class session in mind with  a static arraylist, etc.
    I just have to figure how to do threading of UI  and data


    @ Ilya, how do you deal with multiple forms



  • add control problem with multiple framework