Category Archives: Uncategorized

DataBinding in second, third…TabPages

I have experience in few months ago. I was working on a WinForm application. I placed a TabControl with multiple TabPages. However, I found out that the dataBinding does not work on the second, third or later TabPage controls. After getting some error and test. I found out that the controls in these tabPage are not being loaded until it is “showed”.


So I have some code sample to resolve this, you may try to place it under Page.Load event handling,

    foreach (TabPage tp in tabControl1.TabPages)
    this.tabControl1.SelectedTab = this.tabPage2;


// here I am going to make sure that the dataBinding is completed before select into other tabPages.
// You may try to loop this one by one tabPage if you have more tabPages
    this.tabPage2.BindingContextChanged += (object sender, EventArgs e) => {
        this.tabControl1.SelectedTab = this.tabPage1;

    this.tabControl1.SelectedTab = this.tabPage1;

Hope this article could help you a bit.



Languages features in C# 6 and VB 14

Languages features in C# 6 and VB 14

  • Exists: Already shipped in previous release
  • Added: Implemented for this release
  • Planned: Intended for this release
  • No: Not intended for this release
  • N/A: Not meaningful for this language

Please note that everything is still subject to change – this is a preview after all. However, we are reasonably confident about the overall feature set at this point.

The  VS2015 Preview has the following features. For a description of each feature see:

Feature Example C# VB
Auto-property initializers public int X { get; set; } = x; Added Exists
Getter-only auto-properties public int Y { get; }
= y;
Added Added
Ctor assignment to getter-only autoprops Y = 15 Added Added
Parameterless struct ctors Structure S : Sub New() : End Sub : End Structure Added Added
Using static members using System.Console; …
Added Exists
Dictionary initializer new JObject { [“x”] = 3,
[“y”] = 7 }
Added No
Await in catch/finally try … catch { await … } finally {
await … }
Added No
Exception filters catch(E e) if (e.Count > 5) { … }
Added Exists
Partial modules Partial Module M1 N/A Added
Partial interfaces Partial Interface I1 Exists Added
Multiline string literals “Hello<newline>World” Exists Added
Year-first date literals Dim d = #2014-04-03# N/A Added
Line continuation comments Dim addrs = From c in Customers ‘ comment N/A Added
TypeOf IsNot If TypeOf x
IsNot Customer Then …
N/A Added
Expression-bodied members public double Dist => Sqrt(X * X + Y * Y); Added No
Null propagation customer?.Orders?[5]?.$price Added Added
String interpolation $”{p.First} {p.Last}
is {p.Age}
years old.”
Added* Planned
nameof operator string s = nameof(Console.Write); Added* Planned
#pragma #Disable Warning BC40008 Added Added
Smart name resolution N/A Added
ReadWrite props can implement ReadOnly Exists Added
#region inside methods Exists Added
Overloads inferred from Overrides N/A Added
CObj in attributes Exists Added
CRef and parameter name Exists Added
Extension Add in collection initializers Added Exists
Improved overload resolution Added N/A

*Design changes expected

WinXP and/or Win2003 with SC Forefront Endpoint Protection installed, MsMpEng.exe crashes after definition update


If you are running Windows XP and/or Windows Server 2003 with SC Forefront Endpoint Protection installed, MsMpEng.exe crashes after definition update The system also runs slowly and almost hangs.

Impacted OS:

Windows XP, Windows Server 2003


Disable Behavior Monitoring feature, either in the policy or via the SCEP UI.


Next Action from Microsoft:

We are pending a release of a definition update so BM can be enabled again. We will actively communicate out again as soon as the definition becomes available.

How to Disable Behavior Monitoring feature:

1. Configure Policy with SCCM

2. Configure Policy by GPO

Distribute the Machine Startup/Shutdown Script in registry by using GPO


reg add “HKLM\Software\Microsoft\Microsoft Antimalware\Real-Time Protection” /v “DisableBehaviorMonitoring” /t reg_dword /d 1 /f

3. Update Registry by entering SafeMode

You can also set below registry value to disable BM:

HKLM\Software\Microsoft\Microsoft Antimalware\Real-Time Protection
bleBehaviorMonitoring = 1  (REG_DWORD)

4. FEP – Applying Policies from the Command Prompt

MSSQL Server 2012 Sample DB

I am sure that everyone might have a need to use MSSQL Server Sample Database in every version. And now you could download the sample database for MSSQL Server 2012 too. All you need to do is browse to CodePlex and download it. It is an offical product. You may get the following files,

  1. Adventure Works DW 2012 Data File
  2. Adventure Works Multidimensional Models SQL Server 2012
  3. Analysis Services Tuorial SQL Server 2012
  4. Adventure Works Tabular Mode SQL Server 2012
  5. Adventure Works Internet Sales Tabular Model SQL Server 2012
  6. Adventure Works 2012 CS OLTP Script
  7. Adventure Works 2012 OLTP Script
  8. Adventure Works 2012 CS Data File

Don’t wait and go download it.

Adventure Works for SQL Server 2012 from CodePlex


Solved on LoaderExceptions with Entity Framework

After getting the System.Reflection.ReflectionTypeLoadException when I am developing with Entity Framework for few weeks, I google a lot and found out a helpful related blog and now I solved my problems.

After following what he mentioned and showed out the real informations from the exception, I figure out that there is a internal developed dll in my project’s bin directory, but I never reference it into my project. And this dll is running with another dll from a vendor. The problem never comes up for 2 weeks since I remove that internal developed dll from bin directory. I never expected or think about a “non-reference” existing dll will cause out the problem. Anyway, I hope the rest of the developers who are facing the problem, please read the follow blog, try to implement the code in Global.axas. And I hope the detail information could help you find out what is really going wrong in behind. Cheers~~~

[From Ken Cox] Fed Up With System.Data.Metadata.Edm.ObjectItemAssemblyLoader