Friday, January 28, 2011

Open a Parent window from Child window


window.opener.location.href="default.aspx";

// To make it on top
window.opener.focus();

Everything you would want to know about manipulating windows can usually be found here

Following link has good examples on various operations that can be done on window open in asp.net

http://www.irt.org/script/window.htm

Thursday, January 20, 2011

Steps for Resource File in Windows application

Get the Executing assembly
Assembly executingAssembly = Assembly.GetExecutingAssembly()

Path of executing assembly

string assemblyLocation = executingAssembly.Location;
string dirName = Path.GetDirectoryName(assemblyLocation);

Get the path of UI assembly
Assembly UIassembly = Assembly.LoadFile(Path.Combine(dirName, "dllname"));

Initialize the Resource Manager
ResourceManager = new ResourceManager(@"resourcename", UIassembly);

Thursday, January 6, 2011

Regular Expression for Date in dd/mm/yyyy

^(((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((20[0-9][0-9]))|((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((19[0-9][0-9]))|(29/02/20(([02468][048])|([13579][26])))|(29/02/19(([02468][048])|([13579][26]))))$