Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Page 2 of 4 FirstFirst 12 34 LastLast
Results 16 to 30 of 52

Thread: The .NET Knowledge Sharing Thread

  1. #16

    Default

    Quote Originally Posted by FarligOpptreden View Post
    Awesome stuff. I'll try and get this stickied...
    Thanks, that would be cool. This thread has a long way to go, I haven't even started on Generics, WinForms, Services and COM....
    <sig Type=Disclaimer>UPFRONT DISCLAIMER:(©FarligOpptreden 2009) Don't like my code, speak to them.</sig>
    <sig Type=PimpMySticky>Need help with .NET?</sig>

  2. #17
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    Right, lets hope the right person with the correct permissions responds to my humble little request...

    EDIT: W00t! It's done!
    Last edited by FarligOpptreden; 29-09-2009 at 11:17 AM.
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  3. #18
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    Export data to Office 2007's XML-based formats:

    Right, so you, like many other developers, have grown sick and tired of using the terrible (and mostly redundant) Office Interop APIs to create Excel and Word documents from your precious data... There is a solution in the form of OpenXML. If you didn't know it already, all Office 2007 XML-based documents are essentially an archived file filled with XML files. Don't believe it? Try renaming any .docx or .xlsx file to .zip and extract the contents to a folder. Ta-dah! Study the directory and file structure a bit, especially the .rels files, which indicate the relationship of all the files in the archive.

    So, a more scalable solution to exporting Excel and Word files in the Office 2007 XML format, is to build up the necessary XML files in the correct directory structure, zip them up and rename to .docx or .xlsx (depending on the type of document you just created, obviously ). By conforming to the different Markup Languages specified in the OpenXML framework (i.e. WordML for Word Documents and SpeadsheetML for Excel Spreadsheets) you can easily export any of the data in your application to document formats that business users are constantly badgering you for...

    You might be wondering how on earth you are going to zip up the files from C#, right? Have a look at the SharpZipLib .NET Zip Library. It works wonders.

    So, what's the best thing about this solution? You don't need Office installed on the client or server computer! You might be concerned about the fact that about 75% of your target market might still be stuck on Office 2003, right? Well, that's not necessarily a problem anymore... Just redirect the users here and they will be basking in the OpenXML document glory in no time!
    Last edited by FarligOpptreden; 29-09-2009 at 03:19 PM.
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  4. #19

  5. #20
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    I'll see if I can dig up some resources for WinForms on creating custom-look menus. Struggled with it a few years ago and it's bound to be useful to someone...
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  6. #21

    Default

    Real world tip for n00bs: If you ask for advice, be prepared to follow it before commenting about how it won't work. Experienced programmers take the time out of their day to help you. Try it. If it doesn't work or you don't understand why they suggested the advice or piece of code, please feel free to ask them about it. Some code won't compile because most help will be in the form of pseudo code. It's up to you to interpret this into something workable for yourself.

    Remember, programming is not about language. It's about logic. If you understand the logic, you can apply it to any language of programming you desire. If you expect others to give you working code for a problem they couldn't give two ****s about, don't whine about it.
    Last edited by AcidRaZor; 01-10-2009 at 04:16 PM.

  7. #22

  8. #23
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    Quote Originally Posted by AcidRaZor View Post
    http://www.ajaxload.info/

    For all your loading images' needs
    Thank you, thank you, THANK YOU! I could KISS you right now!

    LOL@"Hey! This service is Web 2.0!"
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  9. #24

    Wink

    What do you expect the output of this program to be?

    Code:
     
    
    using System; 
    
    class Foo
    {
        public Foo(string s)
        {
            Console.WriteLine("Foo constructor: {0}", s);
        }
        public void Bar() { }
    }
    
    class Base
    {
        readonly Foo baseFoo = new Foo("Base initializer");
        public Base()
        {
            Console.WriteLine("Base constructor");
        }
    }
    
    class Derived : Base
    {
        readonly Foo derivedFoo = new Foo("Derived initializer");
        public Derived()
        {
            Console.WriteLine("Derived constructor");
        }
    }
    
    static class Program
    {
        static void Main()
        {
            new Derived();
        }
    }
    "The oldest and strongest emotion of mankind is fear, and the oldest and strongest kind of fear is fear of the unknown" - H.P. Lovecraft

  10. #25
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    Quote Originally Posted by Necuno View Post
    What do you expect the output of this program to be?

    Code:
     
    
    using System; 
    
    class Foo
    {
        public Foo(string s)
        {
            Console.WriteLine("Foo constructor: {0}", s);
        }
        public void Bar() { }
    }
    
    class Base
    {
        readonly Foo baseFoo = new Foo("Base initializer");
        public Base()
        {
            Console.WriteLine("Base constructor");
        }
    }
    
    class Derived : Base
    {
        readonly Foo derivedFoo = new Foo("Derived initializer");
        public Derived()
        {
            Console.WriteLine("Derived constructor");
        }
    }
    
    static class Program
    {
        static void Main()
        {
            new Derived();
        }
    }
    Shouldn't this rather go in the Programming Quiz thread?
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  11. #26

    Default

    Quote Originally Posted by FarligOpptreden View Post
    Shouldn't this rather go in the Programming Quiz thread?
    nope, if you knew the answer you would also know the why* it is so and that is knowledge to share or is it ?

    *spoiler warning


    well i suppose i should rather just link the tut , pleads mini guilty....
    Last edited by Pr⊕phet; 02-10-2009 at 03:02 PM.
    "The oldest and strongest emotion of mankind is fear, and the oldest and strongest kind of fear is fear of the unknown" - H.P. Lovecraft

  12. #27

    Default

    Lambda, Lambda, Lambda - Uncovering the Mystery Behind Lambda Expressions
    Introduction
    At first glance, a lambda expression looks like something your professor may have written on the blackboard in calculus class, but in reality, it is "syntactic sugar" built into the C# language over delegates. In this article, we will begin to explore the nuances of lambda expressions by seeing how they they relate to delegates and how they can be used to implement a popular mathematical formula, the quadratic equation.
    "The oldest and strongest emotion of mankind is fear, and the oldest and strongest kind of fear is fear of the unknown" - H.P. Lovecraft

  13. #28
    Grandmaster FarligOpptreden's Avatar
    Join Date
    Mar 2007
    Location
    Carlswald, Midrand
    Posts
    4,559

    Default

    A simple code snippet to compile a piece of C# code at runtime into an executable, saved at the specified path. The sample adds the necessary assembly files to compile a Windows Application:
    Code:
    Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider();
    System.CodeDom.Compiler.CompilerParameters compiler_params = new System.CodeDom.Compiler.CompilerParameters();
    
    compiler_params.OutputAssembly = path;
    compiler_params.GenerateExecutable = true;
    compiler_params.ReferencedAssemblies.Add("System.dll");
    compiler_params.ReferencedAssemblies.Add("System.Drawing.dll");
    compiler_params.ReferencedAssemblies.Add("System.Windows.Forms.dll");
    
    System.CodeDom.Compiler.CompilerResults results = provider.CompileAssemblyFromSource(compiler_params, source);
    After the code is executed, the "results" variable will contain any compiler errors, so you can easily iterate through the errors to see what went wrong.
    SCubed: Human Capital Management

    Quote Originally Posted by Crossbearer
    To google metal lyrics is not metal. They have to come straight from the heart.
    UPFRONT DISCLAIMER © 2009 FarligOpptreden

  14. #29
    Last edited by dequadin; 11-01-2010 at 12:00 PM.
    <sig Type=Disclaimer>UPFRONT DISCLAIMER:(©FarligOpptreden 2009) Don't like my code, speak to them.</sig>
    <sig Type=PimpMySticky>Need help with .NET?</sig>

  15. #30
    <sig Type=Disclaimer>UPFRONT DISCLAIMER:(©FarligOpptreden 2009) Don't like my code, speak to them.</sig>
    <sig Type=PimpMySticky>Need help with .NET?</sig>

Page 2 of 4 FirstFirst 12 34 LastLast

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •