J
JC
I've tried and tried and this problem eludes me.
I have a form called "main" which has a div tag "DeptInfo" in which I
add my control "Information", here's the code.
---
Dim cont As New Control
cont = LoadControl("Information.ascx")
cont.ID = "Information"
DeptInfo.Controls.Add(cont)
---
At the top of main I added
---
Protected WithEvents Information As Information
---
In main I added
---
Private Sub Information_ProductSelectionChanged(ByVal sender As
Object, ByVal e As CommandEventArgs) Handles
Information.ProductSelectionChanged
'do my stuff here
End Sub
---
In the control information I have at the top
---
Public Event ProductSelectionChanged(ByVal sender As Object, ByVal e
As CommandEventArgs)
---
and raise the event on sel index changed for a ddl:
---
Dim evnt As New CommandEventArgs(DropDownList1.Items(DropDownList1.SelectedIndex).Text,
Nothing)
RaiseEvent ProductSelectionChanged(Me, evnt)
---
Here's the problem, this ALL works if the control as added at design
time by dragging the control onto the form. The event
"Information_ProductSelectionChanged" on form main fires.
How can I wire this up when adding the control dynamically?
How can I reference "main" from "information" and pass info without
having to generate an event?
Thanks for any help!!!
I have a form called "main" which has a div tag "DeptInfo" in which I
add my control "Information", here's the code.
---
Dim cont As New Control
cont = LoadControl("Information.ascx")
cont.ID = "Information"
DeptInfo.Controls.Add(cont)
---
At the top of main I added
---
Protected WithEvents Information As Information
---
In main I added
---
Private Sub Information_ProductSelectionChanged(ByVal sender As
Object, ByVal e As CommandEventArgs) Handles
Information.ProductSelectionChanged
'do my stuff here
End Sub
---
In the control information I have at the top
---
Public Event ProductSelectionChanged(ByVal sender As Object, ByVal e
As CommandEventArgs)
---
and raise the event on sel index changed for a ddl:
---
Dim evnt As New CommandEventArgs(DropDownList1.Items(DropDownList1.SelectedIndex).Text,
Nothing)
RaiseEvent ProductSelectionChanged(Me, evnt)
---
Here's the problem, this ALL works if the control as added at design
time by dragging the control onto the form. The event
"Information_ProductSelectionChanged" on form main fires.
How can I wire this up when adding the control dynamically?
How can I reference "main" from "information" and pass info without
having to generate an event?
Thanks for any help!!!