Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

Posted

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...

UCM

>-)

Posted

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.

Posted

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...

UCM

>-)

Posted

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 :-/

UCM

>-)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...