March 25, 2008

Make Your Mouse Pointer Tremble

To make your mouse pointer appear to be trembling, you first create a form with ScaleMode = 3 – Pixel. Then use the following code: Option ExplicitPrivate Type POINTAPI X As Long Y As LongEnd Type’Windows API functions to set the cursor positionPrivate Declare Function SetCursorPos Lib “User32” (ByVal X

Using Explicit Casting to Display Data

Suppose you’ve retrieved data from a datasource and you want to display the value of field1. Normally, you’d do this by using the &lt%# DataBinder.Eval(Container.DataItem,”field1″) %&gt in the aspx/ascx file. Internally, the DataBinder.Eval method uses reflection to evaluate the argument as well as the result. Thus, it incurs a performance

Validating an XML Document

The following code shows you how to use the DOMImplementationLS and DOMConfiguration classes to validate an XML document only when an XML Schema is present: DOMImplementationLS DOMiLS=null;//get a LSParserLSParser LSP=DOMiLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, “”); //get a DOMConfigurationDOMConfiguration DOMc=LSP.getDomConfig();//validatingif(DOMc.canSetParameter(“schema-type”,””))DOMc.setParameter(“schema-type”,””);else System.out.println(“Error…”);//use validate-if-schemaif(DOMc.canSetParameter(“validate-if-schema”,true)) DOMc.setParameter(“validate-if-schema”,true); else System.out.println(“Error…”);

Displaying “Bit” Database Fields in Web Forms

When you display the value of a field with a “Bit” data types in a Web Form, the values show as True or False, as opposed to the actual value of 0 or 1. However, if you’re using a DataReader to retrieve the data, casting the type explicity to Int