Sharing info between classes, please help.!!!

aikeith

Well-known member
Joined
Jan 23, 2003
Messages
49
I am having major trouble with the following and Im not sure of the syntax line to use.

I have a vb file with 2 classes defined in it. One is for the page and other is for creating a toolbar.

I simply want to pass control back to the first class when the user selects something on the toolbar, then I want to load a user control into a container...

THE EXAMPLE BELOW SHOULD MAKE THIS CLEARER.


Public Class Whatever

has page load event, etc.

Public Sub HandleThis(x As Integer)

below command works
Context.Response.Write("hello")


THE COMMAND BELOW WILL NOT WORK, GET OBJECT REFERENCE NOT SET ERROR!!!! WHAT IS THE CORRECT SYNTAX FOR THE LINE BELOW??

Page.FindControl("PageOutput").Controls.Add(LoadControl("../Apps/TSS/TicketEntry.ascx"))


End Sub


End Class



Public class Toolbar
has constructor and other stuff

The code below send control back to the class above.


Public Overridable Sub ActionHandler(ByVal sender As Object, e As EventArgs) Handles Sweet_Toolbar.SelectedIndexChange

Dim x As New IntraSweetAdmin
x.HandleThis(Sweet_Toolbar.SelectedIndex)

End Sub

End Class


Any help would be extremely appreciated.:confused:
 
uhhh opps.....

my bad....I meant before any subs but just after the form regiegn at the begining of the class...

that should do it...
 
Excuse my ignorance, but that helps me how?

I am passing control back to the 1st class (both classes are defined on the same .vb page) --- Then I am simply wanting to find a control, but it is not initilized at that poing.

I have the variable:

Protected WithEvents PageOutput As PlaceHolder()
before any subs, etc.
 
Ok I see more of what you mean, sorry for the confusion...


Assume you project name is "MyProject", try:
Code:
Public Class First
...
End Class
Code:
Public Class second
MyProject.First.focus()
...
End Class


this is just off the top of my head....

Try it...
 
Crap :(

I dont know asp yet, I was thinking VB....

Maybe someone else on the board knows...

try chaning your original thread subject to:
( ASP.NET ) Sharing info between classes, please help.!!!

That should catch the attentioon of anyone who knows ASP.NET...

Sorry bout that :-/
 
Back
Top