devxlogo

Tip Bank

Use a Validator to Validate a DOMSource

This code snippet creates a Validator that you can use to validate an XML document represented as a DOMSource. //create a DocumentBuilderFactory objectDBF=DocumentBuilderFactory.newInstance(); //activating namespaces supportDBF.setNamespaceAware(true); //create a DocumentBuilder objectDB=DBF.newDocumentBuilder();

Create a Popup Calendar in ASP.NET

This example assumes the main page from which users will pop up the calendar is named Calender.aspx. The following procedure shows how to create the popup calendar: In Calendar.aspx, add

Getting Better Sound Capabilities in .NET 3.0

The .NET Framework includes a SoundPlayer class (in System.Media) that can play sound files. However, this class suffers from two crippling limitations: it can play only PCM-encoded WAV files, and

Error Using JavaScript’s this Keyword

Even though this is a reserved word in JavaScript, the following code fails… with(parent){…this.window.event…} …because it can’t back out of parent. The workaround is to assign the window object to

Create a Generic List at Run Time

You can create a list of a specific type at run time by passing the type to the MakeGenericType method, for example: Type t = Type.GetType(“System.Int32”);IList tList= (IList)Activator.CreateInstance( (typeof(List&lt&gt).MakeGenericType(t))); tList.GetType().FullName