Archive for the ‘Ostatné/Other VC#’ Category

WinForm Exception handler

pondelok, júl 3rd, 2017


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;

namespace WindowsFormsApplication1
    static class Program
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
            // handle the exception raised by main threads
            Application.ThreadException +=
            new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            // handle the exception raised by additional threads
            AppDomain.CurrentDomain.UnhandledException +=
            new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.Run(new Form1());


        static void Application_ThreadException (object sender, System.Threading.ThreadExceptionEventArgs e)
        {// All exceptions thrown by the main thread

        static void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
        {// All exceptions thrown by additional threads
            ShowExceptionDetails(e.ExceptionObject as Exception);

        static void ShowExceptionDetails(Exception Ex)
        {// logging of exception details
            MessageBox.Show(Ex.Message, Ex.TargetSite.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);

Use .NET2.0 DLL into .NET4.0 project

utorok, jún 3rd, 2014

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information...

<?xml version="1.0" encoding="utf-8" ?>
    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

SQLite example

sobota, júl 20th, 2013

sqlite_example (viac…)


nedeľa, jún 23rd, 2013

settingExample (viac…)

Braces matching highlight color

štvrtok, jún 13th, 2013

bm1 (viac…)