RSS Forums RSS
Please support our C# advertiser: Programming Forums

How to create a global function/class ?

Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,167
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to create a global function/class ?

  #2  
Aug 2nd, 2007
1 is easy
right click website or project, 'Add New Item'
Add a class file
add a public static method eg;

myGlobalClass.cs
public class myGlobalClass
{
    public static void myGlobalFunction()
    {
            //function logic ...
    }
}

Call it in your code:

myGlobalClass.myGlobalFunction();

2. Derived DataGrid
Create a separate class library project, add a class file myDataGrid.cs
public class myDataGrid : DataGrid
{
    //add your override members and methods here
}

Look up ToolboxBitMap, ToolboxData and Designer attributes to customise the icon for the toolbox, what is written to the aspx page when you drag your control into the designer and how it looks in the designer.

Build your class library, In your toolbox right click and choose items and browse to the dll you just built, select the control from the list.

3. I don't really understand what you mean with this one sorry.


What you're asking for is too much to explain properly in a single post in a forum, you need to get yourself a good book on the subject, there are hundreds. These forums are really for when you already have made your derived class, function or whatever and you need help tweaking it or getting it to work.
Last edited by hollystyles : Aug 2nd, 2007 at 8:59 am.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:15 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC