locked
Add a control by the code (LEQUEM) - 6/16/2006 5:53 AM PST RRS feed

  • Question

  • By: LEQUEM

    Dear friends,
    Just a little question: I would like to add a control on my scene.
    In C# I used to do (this is an example):
    
       button mybut = new button;
       //I write the button properties
      this.controls.add(mybut); 
    
    And it's ok but this no longer works in IED. How can I do what I want.
    Thank you
         LEQUEM
    Tuesday, February 19, 2008 1:01 AM

Answers

  • By: Glenn Vassallo

    Hi Lequem,

    Gives this a go:-

    System.Windows.Controls.Button buttonTest = new
    System.Windows.Controls.Button();
    DockPanel2.Children.Add(buttonTest);

    I have referenced Button fully as I have both the System.Windows.Controls
    and the System.Windows.Forms directives included in my code, so need to
    reference directly to avoid an ambiguous error. You should not have to do
    this.

    Glenn.

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:FDD38B33-2324-4FD7-8686-0118B78F39F8@microsoft.com...
    > Dear friends,
    > Just a little question: I would like to add a control on my scene.
    > In C# I used to do (this is an example):
    >
    > button mybut = new button;
    > //I write the button properties
    > this.controls.add(mybut);
    >
    > And it's ok but this no longer works in IED. How can I do what I want.
    > Thank you
    > LEQUEM

    Tuesday, February 19, 2008 6:08 PM

All replies

  • By: George Georgiev

    You can add the control to the Children collection of a container control.
    For axample:

    Button mybut = new Button();
    mybut.Content = "Some Text";
    mybut.Width = 100;
    mybut.Height=20;
    myGrid.Children.Add(mybut);

    -- george --

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:FDD38B33-2324-4FD7-8686-0118B78F39F8@microsoft.com...
    > Dear friends,
    > Just a little question: I would like to add a control on my scene.
    > In C# I used to do (this is an example):
    >
    > button mybut = new button;
    > //I write the button properties
    > this.controls.add(mybut);
    >
    > And it's ok but this no longer works in IED. How can I do what I want.
    > Thank you
    > LEQUEM

    Tuesday, February 19, 2008 6:07 PM
  • By: Glenn Vassallo

    Hi Lequem,

    Gives this a go:-

    System.Windows.Controls.Button buttonTest = new
    System.Windows.Controls.Button();
    DockPanel2.Children.Add(buttonTest);

    I have referenced Button fully as I have both the System.Windows.Controls
    and the System.Windows.Forms directives included in my code, so need to
    reference directly to avoid an ambiguous error. You should not have to do
    this.

    Glenn.

    "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    news:FDD38B33-2324-4FD7-8686-0118B78F39F8@microsoft.com...
    > Dear friends,
    > Just a little question: I would like to add a control on my scene.
    > In C# I used to do (this is an example):
    >
    > button mybut = new button;
    > //I write the button properties
    > this.controls.add(mybut);
    >
    > And it's ok but this no longer works in IED. How can I do what I want.
    > Thank you
    > LEQUEM

    Tuesday, February 19, 2008 6:08 PM
  • By: Unni Ravindranathan (MS)

    Yes, George and Glenn are correct. "Not working in EID" is very ambiguous -
    please let us know more details so we can help better.

    Thanks,
    -Unni
    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    "Glenn Vassallo" <glenn@hatesspam.boldintelligence.com> wrote in message
    news:uVrvvlUkGHA.408@TK2MSFTNGP03.phx.gbl...
    > Hi Lequem,
    >
    > Gives this a go:-
    >
    > System.Windows.Controls.Button buttonTest = new
    > System.Windows.Controls.Button();
    > DockPanel2.Children.Add(buttonTest);
    >
    > I have referenced Button fully as I have both the System.Windows.Controls
    > and the System.Windows.Forms directives included in my code, so need to
    > reference directly to avoid an ambiguous error. You should not have to do
    > this.
    >
    > Glenn.
    >
    > "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message
    > news:FDD38B33-2324-4FD7-8686-0118B78F39F8@microsoft.com...
    >> Dear friends,
    >> Just a little question: I would like to add a control on my scene.
    >> In C# I used to do (this is an example):
    >>
    >> button mybut = new button;
    >> //I write the button properties
    >> this.controls.add(mybut);
    >>
    >> And it's ok but this no longer works in IED. How can I do what I want.
    >> Thank you
    >> LEQUEM
    >
    >

    Tuesday, February 19, 2008 6:08 PM
  • By: LEQUEM

    Thank you all for your help. Nice to have an answer from you, Unni. I'm 
    looking forward meeting you in Delhi on next august.
    
    "Not working in IED" meant "imply a compilation error". I'll be less 
    ambiguous the next time.
    
    Regards,
    
        LEQUEM
    
    "Unni Ravindranathan (MS)" wrote:
    
    > Yes, George and Glenn are correct. "Not working in EID" is very ambiguous - 
    > please let us know more details so we can help better.
    > 
    > Thanks,
    > -Unni
    > -- 
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    > "Glenn Vassallo" <glenn@hatesspam.boldintelligence.com> wrote in message 
    > news:uVrvvlUkGHA.408@TK2MSFTNGP03.phx.gbl...
    > > Hi Lequem,
    > >
    > > Gives this a go:-
    > >
    > >       System.Windows.Controls.Button buttonTest = new 
    > > System.Windows.Controls.Button();
    > >       DockPanel2.Children.Add(buttonTest);
    > >
    > > I have referenced Button fully as I have both the System.Windows.Controls 
    > > and the System.Windows.Forms directives included in my code, so need to 
    > > reference directly to avoid an ambiguous error. You should not have to do 
    > > this.
    > >
    > > Glenn.
    > >
    > > "LEQUEM" <LEQUEM@discussions.microsoft.com> wrote in message 
    > > news:FDD38B33-2324-4FD7-8686-0118B78F39F8@microsoft.com...
    > >> Dear friends,
    > >> Just a little question: I would like to add a control on my scene.
    > >> In C# I used to do (this is an example):
    > >>
    > >>   button mybut = new button;
    > >>   //I write the button properties
    > >>  this.controls.add(mybut);
    > >>
    > >> And it's ok but this no longer works in IED. How can I do what I want.
    > >> Thank you
    > >>     LEQUEM
    > >
    > > 
    > 
    > 
    > 
    Tuesday, February 19, 2008 6:08 PM