Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2004, 06:49 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing all the webforms with a function

I want the code in C# so that we write a function to access all the webforms of the project by that function.

 
Old June 16th, 2004, 01:14 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I want to be rich.

Perhaps you'd like to ask a more specific question about a problem. Can you explain in more detail what you are trying to do?
 
Old June 17th, 2004, 11:46 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually we have to write a global function so that we access all that function from all the webforms of the same project. If want to call the function from other webforms. And how to write the function in the .cs file. Please send the reply as soon as possible.

 
Old June 18th, 2004, 08:20 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What are you hoping to achieve with this? With web forms, only one form is "alive" at runtime. Only the webform associated with the requested page is active. You could write a function that itterates thru all the classes in the web form's namespace using reflection, but you would not be able to access an instance of any of those classes. ASP.NET doesn't work like that.
 
Old June 18th, 2004, 02:30 PM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure about what you want to do...

Do you want to do a Public Static function???

If so... :
Static functions could be accessed without any instance, but the code you will put inside should not use any Non-Static objects

Ex:

add this some where in a . CS file (Imagine that it's in WebApplication1.WebForm1):
public static string ReturnString(){
 return "A String";
}

This function will be accessible by any pages,classes of you application or any project using the WebApplication1 reference. To use the function, use this:

string result = WebApplication1.WebForm1.ReturnString();

Is that you searched for?

Thanks

Jonathan

 
Old June 21st, 2004, 05:14 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Jonathan
U r correct but i want a example of this regard. Because i am very new in this field. Can u show a example of adding two numbers by using funcions in C#.net.So that i can call that funcions from other forms.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with accessing function in pageload method nelly78 .NET Framework 2.0 5 September 8th, 2008 06:49 AM
accessing elements using document() function geoGregory3 XSLT 2 February 28th, 2008 07:39 PM
Administrator webforms nabeelalkaff BOOK: ASP.NET Website Programming Problem-Design-Solution 2 September 10th, 2006 11:09 AM
Dynamic Webforms?? MAtkins General .NET 1 December 10th, 2004 06:46 PM
messagebox in webforms nmohammadi Forum and Wrox.com Feedback 2 June 6th, 2003 06:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.