I think I see now what you are doing.
I am not sure though when you want the communication to take place. Do you
want it to take place during design as well, or during execution?
If your user control declares any public events then it will be declared
WithEvents when you drop it onto the parent. You can then write code at
design time to handle the events that it raises, and hook it up with the
Handles keyword, for example
<code>
Public Class UserControlB
Inherits UserControl
' Windows Form Designer Generated Code
' Includes the following:
Private WithEvents TextBox1 As TextBox
Public Event DoStuff(sender As Object, e As DoStuffEventArgs) ' **
this is a shortcut; look at delegates **
' ...
Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles
TextBox1.Click()
RaiseEvent DoStuff(Me, New DoStuffEventArgs)
End Sub
End Class
Public Class UserControlA
Inherits UserControl
' Windows Form Designer Generated Code
' Includes the following:
Private WithEvents UserControlB1 As UserControlB
Private Sub UserControlB1_DoStuff(sender As Object, e As
DoStuffEventArgs) Handles UserControlB1.DoStuff
' Code here to handle event from UserControlB
End Sub
End Class
</code>
I haven't tried to compile the code above, but the principle should be ok.
If I have still misunderstood, perhaps you could post some of the code you
have so far. It might be easier to help by filling in the gaps of a concrete
example.
HTH
Charles
"Art" <arthlan> wrote in message
news:AD**********************************@microsof t.com...
Charles,
I'm writing this before I fully understand your latest answer, mostly to
give you more time, (if you have it). As a brief aside... even though I'm
still having difficulty, your answers so far have helped me to understand
more of this new vb.net world -- so thanks very much for all of the info so
far.
One thing I didn't make clear, and perhaps I shouldn't be doing this
anyway, is that I'm dragging the text box over during the design of the main
form. From your description it sounds like you are envisioning that this
drag happens during the execution.
Also (and I said I was new to this) you mention that you're working on an
MDI application. I had to look that up -- if I found the right thing,
that's a multiple document interface? It may be that there's something in
that area that I should spend some time learning.
Your diagram of my setup is correct. Again, the only difference -may be-
that I'm dragging during the design. Normally when I put an AddHandler
statement I have had to dim the control WithEvents for my parent to respond
to the events. I don't see how to do this at design time. I'll have to
spend a little time going over what you've described, but I'm guessing that
the DragDrop event isn't going to have effect when I'm designing my form.
Art