Tuesday 29 April 2008

C# Constructors

See full discussion here

Base

public myClass() : base()

Overload

class myClass
{
public myClass()
{
//No parameters
}

public myClass(string param1) : this()
{
//No parameters will be called before me!
}
}

Monday 28 April 2008

Asp.Net : "A first chance exception"

Getting huge amount of "A first chance exception" messages when running web-site under IDE for first time (after a rebuild).

These were being reported because programmer had turned off 'Just my code' within Tools->Options->Debugging->General

Tuesday 22 April 2008

SQL Server : Query on date and HQL

Date format is 'YYYY-MM-DD'

e.g.

select * from orders where Date='2008-04-22'



HQL (as literal)

from Activity a where a.Date between '2008-01-01' and '2008-02-29'

Thursday 3 April 2008

Bind Dictionary to WinForm ComboBox

To bind a dictionary to a combo box:

 

            cmbTable.DisplayMember = "Key";
cmbTable.ValueMember = "Value";
cmbTable.DataSource = new BindingSource(myDictionary, null);