Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tim Paaschen

@Tim Paaschen
About
Posts
57
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • delegate Question
    T Tim Paaschen

    I had a second look at your code snippet. I guess that this (on which you call Invoke) ist your control. You may try to call BeginInvoke on the delegate itself.

    C# question com design tools help

  • delegate Question
    T Tim Paaschen

    Try BeginInvoke() for asynchronous execution of the delegate.

    C# question com design tools help

  • inheriting from a class and also using a constraint
    T Tim Paaschen

    This one compiles (in VS2005): class BarStream<T> : IBarStream where T : Barable { } Regards, Tim

    C# tutorial question

  • Source Code
    T Tim Paaschen

    Nitin Raj wrote:

    I need the source code for a software "HealthWatch Pro 2.0". how do i get it. Can someone please help me to get it.

    I recommend you try the legal way: contact the manufacturer and ask for a quote. Regards, Tim

    C# help question

  • C# Generic: Is this a bug or by design
    T Tim Paaschen

    mschuckmann wrote:

    If you leave out the where constraint you've essentially specified a generic with a constraint of object and you can't call any methods except those declared by object. Therefore my example code will not compile without the where constraint. So sure you can impliment generics without type constraints but don't expect to do anything interesting in your generic code.

    I do agree to your point of view, that the limitation of generics in regard to derived classes are unexpected. As a workaround you can use an interface, that defines the required methods, as the constraint. However, you must explicitly specify the interface for each class:

    interface Named
    {
    void Name();
    };

    class Base : Named
    {
    public void Name()
    {
    Console.WriteLine("I'm a Base class");
    }
    };

    class Middle : Base, Named
    {
    public new void Name()
    {
    Console.Write("I'm a Middle class");
    }
    };

    class Child : Middle, Named
    {
    public new void Name()
    {
    Console.Write("I'm a Child class");
    }
    };

    class Program
    {
    static void PrintName<T>( T instance ) where T : Named
    {
    instance.Name();
    }

    static void Main( string\[\] args )
    {
    	Child c = new Child();
    	PrintName( c );
    	Console.ReadLine();
    }
    

    }

    Regards, Tim

    C# csharp design help question

  • std::set to store pointers
    T Tim Paaschen

    If you store pointers in a set, the set is ordered by the pointer values (the addresses) and not by the values of your objects. You can either provide a customized comparer function object as the second template parameter or use the boost::ptr_set.

    Regards, Tim

    C / C++ / MFC c++ help question

  • How to import a namespace
    T Tim Paaschen

    If I remember correctly, the default namespace matches the name of the library. Use the "OLE/COM Object Viewer" (you find it in the Tools menu of Visual Studio), browse to the according Type Library and open it. Somewhere you will find something like:

    [
    ...
    ]
    library SERVERLib
    {
    ...
    }

    In this case SERVERLib will be the default namespace.

    Regards, Tim

    C / C++ / MFC question tutorial

  • How to import a namespace
    T Tim Paaschen

    I guess that you are talking of a COM-DLL and the #import directive. In this case you can use the rename attribute. If the COM-DLL already provides a namespace the attribute rename-namespace may be useful, too.

    Regards, Tim

    C / C++ / MFC question tutorial

  • Hey folks, that's funny...
    T Tim Paaschen

    In C++ this expression results in undefined behavior. Look here[^] for details.

    Regards, Tim

    C# csharp c++ java question

  • How to set date time format as &quot;MM/DD/YYYY&quot; for the entire application (including referring dlls)
    T Tim Paaschen

    I typically set the Application.CurrentCulture property in addition to the thread properties. Are you sure that the DLLs make use of the thread's culture settings? Maybe their localisation is hard-coded or they utilize the OS culture (CultureInfo.InstalledUICulture).

    Regards, Tim

    C# tutorial question

  • Custom Collection Class
    T Tim Paaschen

    Martin# wrote:

    Think about that again! ...

    I never said that it is a good idea - just that it is technically possible.

    Regards, Tim

    C# help

  • Custom Collection Class
    T Tim Paaschen

    This is a really strange idea! All possible keys must be known at compile-time. However, technically this can be achieved by adding a Dictionary member to you custom Collection and provide a property for each possible key that just wraps the indexer of the dictionary.

    Regards, Tim

    C# help

  • How to unregister a addin from MS Word?
    T Tim Paaschen

    So how about "regsvr32 -u *.DLL"?

    Regards, Tim

    C / C++ / MFC question tutorial

  • Interfacing between MATLAB and C++
    T Tim Paaschen

    This article[^] should give you an introduction how to make a DLL from a MatLab code and how to use it from C/C++. However, to build the DLL (or an EXE) you will need the MatLab Compiler (mcc). If the mcc comand fails on your machine, you most propably don't have the MatLab Compiler installed. If I remember correctly, it is not part of the basic installation but must be bought separately (as many other MatLab toolboxes, too).

    Regards, Tim

    C / C++ / MFC c++ help

  • how to make .exe file by MatLab
    T Tim Paaschen

    You will have to buy the MatLab compiler.

    Regards, Tim

    Algorithms question tutorial

  • Exception Handling: Object creation within try block
    T Tim Paaschen

    If you provide a default constructor, I would recommend not to use a second constructor for your purpose. Instead provide a method. Currently you assign a new object within the try/catch-block and I'm not sure what happens to s, if an exception is thrown within the second constructor.

    Goebel wrote:

    public class SampleClass
    {
    public SampleClass()
    {
    this.param1 = 1;
    this.param2 = 1;
    }

    public **Assign**(int param1, int param2)
    {
            int param1;
            int param2; 
    
            if (param1 % param2 != 0)
            {
                throw new Exception(); 
            }
    
            this.param1 = param1;
            this.param2 = param2; 
    }
    
    public void Action()
    {
        // Some weird stuff in here.
    }
    

    }

    public class Tester
    {
    class Program
    {
    static void Main(string[] args)
    {
    SampleClass s = new SampleClass();

            try
            {
                **s.Assign(20, 20);**
            }
            catch (Exception e)
            {
                // Do processing here.
            }
    
            s.Action();
        }
    }
    

    }

    Regards, Tim

    C# tutorial help question

  • Exception Handling: Object creation within try block
    T Tim Paaschen

    public class Tester
    {
    class Program
    {
    static void Main(string[] args)
    {
    SampleClass s = null;

            try
            {
                s = new SampleClass(20, 20);
            }
            catch (Exception e)
            {
                // Do processing here.
                **s = null;**
            }
    
    
            **if( s != null )**
            **{**
                s.Action();  // Compiler says: Use of unassigned local variable 's'
            **}**
        }
    }
    

    }

    This version should do the trick.

    Regards, Tim

    C# tutorial help question

  • Blocking Multiple Application accessing the same file
    T Tim Paaschen

    AFAIK the ReaderWriterLock is local to a process. You will have to use a named Mutex, that has system scope and thus can be shared between processes.

    Regards, Tim

    C# xml

  • passing "this" by reference
    T Tim Paaschen

    Hi, as Luc already suggested, you can just drop the 'ref' from your method's parameter and everything should work. I will just add some explanation why you must not pass 'this' as a ref parameter. If you have a value object (a struct) and you pass it by value (no 'ref' parameter) to the method, the method gets its own copy and the original will not be affected by any changes made in the method. If the value object is passed by reference, all changes do affect the original. If you have a reference object (a class) and you pass it by value, the reference itself is copied. Thus you have two references to the same object. If the method changes the referenced object, the changes will affect the original. However, if the method changes the reference itself (e.g. set it to 'null'), this will not affect the original reference. If you pass the reference object as a reference parameter, you are able not only to manipulate the referenced object but also the reference itself. Sometimes this is the desired behaviour, but you definitely don't want enable any method to set your 'this' reference to 'null'. Therefore 'this' is read-only and must not be passed by reference. Hope this helps.

    Regards, Tim

    C# help question

  • IsolatedStorage - How to store application config for more than one user?
    T Tim Paaschen

    I typically use Application.CommonAppDataPath to store the global configuration files.

    Regards, Tim

    .NET (Core and Framework) question windows-admin tutorial workspace
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups