Click here to Skip to main content
15,888,148 members
Home / Discussions / C#
   

C#

 
GeneralRe: Receiving Input from other processes/OS (aka Standard In) Pin
Heath Stewart23-Sep-03 8:47
protectorHeath Stewart23-Sep-03 8:47 
GeneralNewbie in C# Pin
Member 59611223-Sep-03 4:42
Member 59611223-Sep-03 4:42 
GeneralRe: Newbie in C# Pin
Heath Stewart23-Sep-03 6:02
protectorHeath Stewart23-Sep-03 6:02 
GeneralRe: Newbie in C# Pin
Michael P Butler23-Sep-03 6:44
Michael P Butler23-Sep-03 6:44 
GeneralSystem.UnauthorizedAccessException Pin
ich_bins23-Sep-03 4:29
ich_bins23-Sep-03 4:29 
GeneralControl Designer & Child Controls Issue Pin
scott@otech.com23-Sep-03 4:14
scott@otech.com23-Sep-03 4:14 
GeneralRe: Control Designer & Child Controls Issue Pin
Heath Stewart23-Sep-03 5:50
protectorHeath Stewart23-Sep-03 5:50 
GeneralRe: Control Designer & Child Controls Issue Pin
scott@otech.com23-Sep-03 6:20
scott@otech.com23-Sep-03 6:20 
Well actually this isn't my exact problem. Smile | :) I didn't feel like typing a whole big mess so I just copied this problem from someone else's post on another site because what he is trying to accomplish is the same as what I'm trying to accomplish:

Allowing a control added to a user control in the designer to really be parented to a child control of that user control whether it be added through a custom verb event, or dropped onto the control...

In my designer for the top level parent I've got some code like this to add a new control to the parent control in response to the use of a custom verb:

<br />
Private Sub OnAddButton(ByVal sender As Object, ByVal e As EventArgs)<br />
            Dim b As XPanderLinkLabel<br />
            Dim h As IDesignerHost = DirectCast(GetService(GetType(IDesignerHost)), IDesignerHost)<br />
            Dim dt As DesignerTransaction<br />
            Dim c As IComponentChangeService = DirectCast(getservice(GetType(IComponentChangeService)), IComponentChangeService)<br />
<br />
            'Add a new button to the collection<br />
            dt = h.CreateTransaction("Add Link")<br />
            c.OnComponentChanging(m_XPander, Nothing)<br />
            b = DirectCast(h.CreateComponent(GetType(XPanderLinkLabel)), XPanderLinkLabel)<br />
            m_XPander.contentpanel.controls.add(b)<br />
            c.OnComponentChanged(m_XPander, Nothing, Nothing, Nothing)<br />
            dt.Commit()<br />
        End Sub<br />


And then in the parent control I handle the OnControlAdded event of the internal panel that I want to be the "true parent"

<br />
        Private Sub pnlLinks_ControlAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.ControlEventArgs) Handles pnlLinks.ControlAdded<br />
        If TypeOf (e.Control) Is XPanderLinkLabel Then<br />
                Me.Links.Add(DirectCast(e.Control, XPanderLinkLabel))<br />
                DirectCast(e.Control, XPanderLinkLabel).ImageList = Me.ImageList<br />
                e.Control.Dock = DockStyle.Top<br />
                Invalidate()<br />
            End If<br />
        End Sub<br />


This was the first approach that I tried and it did not work because the code was never output. I would get this error at compile time:

".net Code generation for property 'Controls' failed. Error was: 'Object reference not set to an instance of an object."

Essentially I don't care how I can accomplish it, I just want to somehow be able to have the control dropped on the parent control or added through a custom verb to really be parented to the internal control.
GeneralRe: Control Designer &amp; Child Controls Issue Pin
Heath Stewart23-Sep-03 6:47
protectorHeath Stewart23-Sep-03 6:47 
GeneralRe: Control Designer &amp; Child Controls Issue Pin
scott@otech.com24-Sep-03 7:51
scott@otech.com24-Sep-03 7:51 
GeneralRe: Control Designer &amp; Child Controls Issue Pin
Heath Stewart24-Sep-03 8:50
protectorHeath Stewart24-Sep-03 8:50 
GeneralRe: Control Designer &amp; Child Controls Issue Pin
scott@otech.com24-Sep-03 9:02
scott@otech.com24-Sep-03 9:02 
Questioncopy constructor needed? Pin
berndg23-Sep-03 2:59
berndg23-Sep-03 2:59 
AnswerRe: copy constructor needed? Pin
Heath Stewart23-Sep-03 3:12
protectorHeath Stewart23-Sep-03 3:12 
GeneralRe: copy constructor needed? Pin
Alvaro Mendez23-Sep-03 4:43
Alvaro Mendez23-Sep-03 4:43 
GeneralRe: copy constructor needed? Pin
Heath Stewart23-Sep-03 5:39
protectorHeath Stewart23-Sep-03 5:39 
GeneralRe: copy constructor needed? Pin
Alvaro Mendez23-Sep-03 10:37
Alvaro Mendez23-Sep-03 10:37 
GeneralRe: copy constructor needed? Pin
Heath Stewart23-Sep-03 10:47
protectorHeath Stewart23-Sep-03 10:47 
GeneralRe: copy constructor needed? Pin
Alvaro Mendez23-Sep-03 11:01
Alvaro Mendez23-Sep-03 11:01 
GeneralRe: copy constructor needed? Pin
Heath Stewart23-Sep-03 13:04
protectorHeath Stewart23-Sep-03 13:04 
GeneralWebservice over SSL with multiple servers Pin
solidstore23-Sep-03 1:14
solidstore23-Sep-03 1:14 
GeneralRe: Webservice over SSL with multiple servers Pin
Heath Stewart23-Sep-03 3:25
protectorHeath Stewart23-Sep-03 3:25 
GeneralRe: Webservice over SSL with multiple servers Pin
solidstore23-Sep-03 3:54
solidstore23-Sep-03 3:54 
GeneralRe: Webservice over SSL with multiple servers Pin
Heath Stewart23-Sep-03 4:34
protectorHeath Stewart23-Sep-03 4:34 
GeneralRe: Webservice over SSL with multiple servers Pin
Heath Stewart23-Sep-03 4:36
protectorHeath Stewart23-Sep-03 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.