aikeith Posted January 23, 2003 Posted January 23, 2003 I am having major trouble with the following and I'm 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: Quote
UCM Posted January 23, 2003 Posted January 23, 2003 Try putting this at the top of your code just before any classes: Private abc as Whatever Check out the information in This Post :-) Quote UCM >-)
aikeith Posted January 23, 2003 Author Posted January 23, 2003 I get "statement is not valid in a NameSpace" When I put that outside of the Classes Quote
UCM Posted January 23, 2003 Posted January 23, 2003 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... Quote UCM >-)
aikeith Posted January 23, 2003 Author Posted January 23, 2003 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. Quote
UCM Posted January 23, 2003 Posted January 23, 2003 Ok I see more of what you mean, sorry for the confusion... Assume you project name is "MyProject", try: Public Class First ... End Class Public Class second MyProject.First.focus() ... End Class this is just off the top of my head.... Try it... Quote UCM >-)
aikeith Posted January 23, 2003 Author Posted January 23, 2003 Thats a big negative. This is an ASP.NET web app, no focus available. hmmm. Quote
UCM Posted January 23, 2003 Posted January 23, 2003 Crap :( I don't 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 :-/ Quote UCM >-)
aikeith Posted January 24, 2003 Author Posted January 24, 2003 Thats ok, I appreciate your trying to help. I will try the re-post. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.